use crate::observability::MetricsRegistry;

/// Records a cache event and emits a low-cardinality tracing event.
pub fn record_cache_event(
    metrics: Option<&MetricsRegistry>,
    component: &str,
    operation: &str,
    result: &str,
) {
    if let Some(metrics) = metrics {
        metrics.record_cache_event_with_component(component, operation, result);
    }
    let span = tracing::debug_span!(
        "rs_zero.cache.event",
        component = component,
        operation = operation,
        result = result
    );
    let _entered = span.enter();
    tracing::debug!("cache event recorded");
}
