Skip to main content

record_llm_metrics

Function record_llm_metrics 

Source
pub fn record_llm_metrics(
    model: &str,
    prompt_tokens: usize,
    completion_tokens: usize,
    cost_usd: f64,
    duration_secs: f64,
)
Expand description

Record LLM metrics via tracing events.

In the server crate (a3s-code), this is overridden by telemetry_init::record_llm_metrics which writes to OpenTelemetry counters. In the core library, we emit a tracing event so the data is available to any subscriber (including OTel if wired up externally).