Skip to main content

Module metrics

Module metrics 

Source

Functions§

init
Initialize the Prometheus metrics exporter.
metrics_handle
Get the Prometheus handle for rendering metrics.
record_cache_tokens
Record prompt-cache token usage (write = cache miss tokens, read = cache hit tokens).
record_eval_regression
Increment the count of eval regressions detected against a baseline.
record_eval_score
Set the mean score for an eval suite + scorer (0.0–1.0).
record_guardrail_flagged
Increment the count of chat inputs flagged by an input guardrail, by category (injection | pii).
record_llm_call_latency
Record the wall-clock duration of a single LLM driver call.
record_llm_cost
Record an estimated per-request LLM cost in USD. Recorded as a histogram so the _sum series gives cumulative spend while preserving per-run distribution.
record_llm_tokens
Record LLM token usage.
record_provider_health
Record a provider’s current health (CH-03): 1.0 when available, 0.0 when in a failover cooldown window.
record_request
Record an HTTP request completion.
record_sandbox_created
Record sandbox creation.
record_sandbox_error
Record sandbox error.
record_sandbox_execution
Record sandbox execution duration.
record_skill_activation
Record a skill-activation decision: which skill was selected for an intent, by which classifier backend, and whether it was accepted (vs. an override / fallback). Enables per-skill / per-backend precision-recall accounting — the prerequisite for measuring and improving activation accuracy (fable §8, plan CH-08).
record_skill_activation_outcome
Record that an activated skill’s execution succeeded or failed — pairs with record_skill_activation to distinguish “chosen” from “chosen and worked”.
record_skill_invocation
Exact host activation, distinct from matcher acceptance.
record_skill_request_usage
Attribution only. Never updates the ordinary token or cost totals.
record_skill_shadow_recall
One explicit activation is the ground-truth sample for Recall@10. The histogram’s sum / count is recall; this does not filter any catalog.
record_sycophancy_flagged
Increment the count of responses flagged as sycophantic.
record_sycophancy_score
Record the sycophancy score (0.0 clean – 1.0 fully sycophantic) of a response.
record_tool_call
Record a tool call result.
request_timer
Create a request timer. Call .finish() on the returned value when done.
sandbox_active_dec
A sandbox execution finished — decrement the in-flight gauge.
sandbox_active_inc
A sandbox execution started — increment the in-flight gauge.
set_a2ui_replay_runs
Set the number of runs with retained A2UI replay state.
set_active_sandboxes
Set active sandbox count gauge.
set_active_sessions
Set the active session count gauge.
set_mcp_server_status
Record MCP server status.
set_runs_retained
Set the number of run records retained for replay and diagnostics.