Expand description
Telemetry and metrics collection following OpenTelemetry GenAI conventions.
Provides lock-free, zero-allocation metrics collection for:
- Token usage (input, output, saved, compression ratio)
- Tool call latency and success rates
- Search quality metrics (latency, result counts)
- Embedding inference performance
- Cache hit/miss rates
Naming follows the OpenTelemetry GenAI Semantic Conventions: https://opentelemetry.io/docs/specs/semconv/gen-ai/
Structs§
- Metrics
- Metrics
Snapshot - Point-in-time snapshot of all metrics.
- Tool
Call Timer - RAII guard that records tool call latency on drop.
Functions§
- global_
metrics - info_
tags - Deployment tags shared by the Prometheus
lean_ctx_infoseries and the Datadog push exporter. Values are bounded: project is the cwd basename (never the full path), model/profile/role come from bounded registries — cardinality stays at one series per running process.