Skip to main content

rs_zero/observability/
cache.rs

1use crate::observability::MetricsRegistry;
2
3/// Records a cache event and emits a low-cardinality tracing event.
4pub fn record_cache_event(
5    metrics: Option<&MetricsRegistry>,
6    component: &str,
7    operation: &str,
8    result: &str,
9) {
10    if let Some(metrics) = metrics {
11        metrics.record_cache_event_with_component(component, operation, result);
12    }
13    let span = tracing::debug_span!(
14        "rs_zero.cache.event",
15        component = component,
16        operation = operation,
17        result = result
18    );
19    let _entered = span.enter();
20    tracing::debug!("cache event recorded");
21}