misc tracing span tweaks

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-12-08 20:31:16 +00:00
parent 5fc8e90e02
commit aba88ccead
16 changed files with 96 additions and 24 deletions

View file

@ -307,7 +307,12 @@ pub(crate) fn repair(db_opts: &Options, path: &PathBuf) -> Result<()> {
Ok(())
}
#[tracing::instrument(skip(msg), name = "rocksdb", level = "trace")]
#[tracing::instrument(
parent = None,
name = "rocksdb",
level = "trace"
skip(msg),
)]
pub(crate) fn handle_log(level: LogLevel, msg: &str) {
let msg = msg.trim();
if msg.starts_with("Options") {

View file

@ -33,7 +33,7 @@ where
}
#[implement(super::Map)]
#[tracing::instrument(skip(self, keys), name = "batch_blocking", level = "trace")]
#[tracing::instrument(name = "batch_blocking", level = "trace", skip_all)]
pub(crate) fn get_batch_blocking<'a, I, K>(&self, keys: I) -> impl Iterator<Item = Result<Handle<'_>>> + Send
where
I: Iterator<Item = &'a K> + ExactSizeIterator + Debug + Send,

View file

@ -10,7 +10,7 @@ pub(crate) type MapsKey = String;
pub(crate) fn open(db: &Arc<Engine>) -> Result<Maps> { open_list(db, MAPS) }
#[tracing::instrument(skip_all, level = "debug")]
#[tracing::instrument(name = "maps", level = "debug", skip_all)]
pub(crate) fn open_list(db: &Arc<Engine>, maps: &[&str]) -> Result<Maps> {
Ok(maps
.iter()

View file

@ -113,10 +113,14 @@ async fn spawn_until(self: &Arc<Self>, recv: Receiver<Cmd>, max: usize) -> Resul
}
#[implement(Pool)]
#[tracing::instrument(
name = "spawn",
level = "trace",
skip_all,
fields(id = %workers.len())
)]
fn spawn_one(self: &Arc<Self>, workers: &mut JoinSet<()>, recv: Receiver<Cmd>) -> Result {
let id = workers.len();
debug!(?id, "spawning");
let self_ = self.clone();
let _abort = workers.spawn_blocking_on(move || self_.worker(id, recv), self.server.runtime());
@ -181,7 +185,14 @@ async fn execute(&self, cmd: Cmd) -> Result {
}
#[implement(Pool)]
#[tracing::instrument(skip(self, recv))]
#[tracing::instrument(
parent = None,
level = "debug",
skip(self, recv),
fields(
tid = ?std::thread::current().id(),
),
)]
fn worker(self: Arc<Self>, id: usize, recv: Receiver<Cmd>) {
debug!("worker spawned");
defer! {{ debug!("worker finished"); }}