Add fetch span (#875)

* Add fetch span

* Use `{}`

* Only add fetch span in debug builds
This commit is contained in:
Micha Reiser 2025-05-26 18:51:02 +02:00 committed by GitHub
parent b1b8b4333c
commit 393cf7c7de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -14,6 +14,10 @@ where
let (zalsa, zalsa_local) = db.zalsas();
zalsa.unwind_if_revision_cancelled(zalsa_local);
let database_key_index = self.database_key_index(id);
#[cfg(debug_assertions)]
let _span = tracing::debug_span!("fetch", query = ?database_key_index).entered();
let memo = self.refresh_memo(db, zalsa, id);
// SAFETY: We just refreshed the memo so it is guaranteed to contain a value now.
let memo_value = unsafe { memo.value.as_ref().unwrap_unchecked() };
@ -21,7 +25,7 @@ where
self.lru.record_use(id);
zalsa_local.report_tracked_read(
self.database_key_index(id),
database_key_index,
memo.revisions.durability,
memo.revisions.changed_at,
memo.revisions.accumulated.is_some(),