diff options
author | Matthew Gumport <[email protected]> | 2024-11-19 14:03:04 -0800 |
---|---|---|
committer | Yuchen Wu <[email protected]> | 2024-12-13 16:25:44 -0800 |
commit | 3f0f68b0ec75ccf181c86786ea17f644bbdfafd2 (patch) | |
tree | 9cc2c73c3488d0198f5cae3524ca15f445f4c9a5 /pingora-cache/src/lib.rs | |
parent | dcb40b620eb49dd9482d108dbf6751048a3859ad (diff) | |
download | pingora-3f0f68b0ec75ccf181c86786ea17f644bbdfafd2.tar.gz pingora-3f0f68b0ec75ccf181c86786ea17f644bbdfafd2.zip |
expose getters for cache and hit spansbleeper-yuchen-fc39bb0c3d35fa5e07c21c261c2a5a68af53d440
Diffstat (limited to 'pingora-cache/src/lib.rs')
-rw-r--r-- | pingora-cache/src/lib.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/pingora-cache/src/lib.rs b/pingora-cache/src/lib.rs index f747672..bc370b7 100644 --- a/pingora-cache/src/lib.rs +++ b/pingora-cache/src/lib.rs @@ -457,9 +457,19 @@ impl HttpCache { } } + // Get the cache parent tracing span + pub fn get_cache_span(&self) -> Option<trace::SpanHandle> { + self.inner.as_ref().map(|i| i.traces.get_cache_span()) + } + // Get the cache `miss` tracing span - pub fn get_miss_span(&mut self) -> Option<trace::SpanHandle> { - self.inner.as_mut().map(|i| i.traces.get_miss_span()) + pub fn get_miss_span(&self) -> Option<trace::SpanHandle> { + self.inner.as_ref().map(|i| i.traces.get_miss_span()) + } + + // Get the cache `hit` tracing span + pub fn get_hit_span(&self) -> Option<trace::SpanHandle> { + self.inner.as_ref().map(|i| i.traces.get_hit_span()) } // shortcut to access inner, panic if phase is disabled |