diff options
author | Edward Wang <[email protected]> | 2024-11-06 13:55:43 -0800 |
---|---|---|
committer | Edward Wang <[email protected]> | 2024-11-06 14:03:01 -0800 |
commit | 2d110d8e68c261e772e2a8b51f5a3d5a5a9e2bc8 (patch) | |
tree | 8b225928bb509926e16ea58d975b73bb933152ec /pingora-cache/src/lib.rs | |
parent | e89f198243b0b375383eacff7d2eed48d019c398 (diff) | |
download | pingora-2d110d8e68c261e772e2a8b51f5a3d5a5a9e2bc8.tar.gz pingora-2d110d8e68c261e772e2a8b51f5a3d5a5a9e2bc8.zip |
Fix cache meta trace tags
Currently the meta is attempted to be logged in a hit span that may or
may not exist (or has not started) depending on the cache phase.
Diffstat (limited to 'pingora-cache/src/lib.rs')
-rw-r--r-- | pingora-cache/src/lib.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pingora-cache/src/lib.rs b/pingora-cache/src/lib.rs index a82c799..6bebbd3 100644 --- a/pingora-cache/src/lib.rs +++ b/pingora-cache/src/lib.rs @@ -492,14 +492,14 @@ impl HttpCache { inner.lock = Some(lock.lock(key)); } } - inner.traces.log_meta(&meta); + inner.traces.start_hit_span(phase, hit_status); + inner.traces.log_meta_in_hit_span(&meta); if let Some(eviction) = inner.eviction { // TODO: make access() accept CacheKey let cache_key = key.to_compact(); // FIXME: get size eviction.access(&cache_key, 0, meta.0.internal.fresh_until); } - inner.traces.start_hit_span(phase, hit_status); inner.meta = Some(meta); inner.body_reader = Some(hit_handler); } @@ -717,7 +717,8 @@ impl HttpCache { // TODO: store the staled meta somewhere else for future use? CachePhase::Stale | CachePhase::Miss => { let inner = self.inner_mut(); - inner.traces.log_meta(&meta); + // TODO: have a separate expired span? + inner.traces.log_meta_in_miss_span(&meta); inner.meta = Some(meta); } _ => panic!("wrong phase {:?}", self.phase), |