mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-08-04 11:00:05 +00:00
Add fetch span (#875)
* Add fetch span * Use `{}` * Only add fetch span in debug builds
This commit is contained in:
parent
b1b8b4333c
commit
393cf7c7de
1 changed files with 5 additions and 1 deletions
|
@ -14,6 +14,10 @@ where
|
||||||
let (zalsa, zalsa_local) = db.zalsas();
|
let (zalsa, zalsa_local) = db.zalsas();
|
||||||
zalsa.unwind_if_revision_cancelled(zalsa_local);
|
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);
|
let memo = self.refresh_memo(db, zalsa, id);
|
||||||
// SAFETY: We just refreshed the memo so it is guaranteed to contain a value now.
|
// 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() };
|
let memo_value = unsafe { memo.value.as_ref().unwrap_unchecked() };
|
||||||
|
@ -21,7 +25,7 @@ where
|
||||||
self.lru.record_use(id);
|
self.lru.record_use(id);
|
||||||
|
|
||||||
zalsa_local.report_tracked_read(
|
zalsa_local.report_tracked_read(
|
||||||
self.database_key_index(id),
|
database_key_index,
|
||||||
memo.revisions.durability,
|
memo.revisions.durability,
|
||||||
memo.revisions.changed_at,
|
memo.revisions.changed_at,
|
||||||
memo.revisions.accumulated.is_some(),
|
memo.revisions.accumulated.is_some(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue