Skip to main content

Module telemetry

Module telemetry 

Source
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
MetricsSnapshot
Point-in-time snapshot of all metrics.
ToolCallTimer
RAII guard that records tool call latency on drop.

Functions§

global_metrics
info_tags
Deployment tags shared by the Prometheus lean_ctx_info series 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.