Prometheus and OpenTelemetry

NadirClaw exposes a Prometheus /metrics endpoint with request, token, cost and latency metrics, plus OpenTelemetry tracing and an example Grafana dashboard.

NadirClaw exposes a Prometheus-compatible metrics endpoint and supports OpenTelemetry for distributed tracing.

Prometheus endpoint

Metrics are available at http://localhost:8856/metrics when the telemetry extra is installed.

Install
pip install nadirclaw[telemetry]

Available metrics

MetricTypeDescription
nadirclaw_requests_totalcounterTotal requests processed
nadirclaw_tokens_prompt_totalcounterTotal prompt tokens
nadirclaw_tokens_completion_totalcounterTotal completion tokens
nadirclaw_cost_dollars_totalcounterTotal cost in USD
nadirclaw_request_latency_mshistogramRequest latency in milliseconds
nadirclaw_cache_hits_totalcounterTotal cache hits
nadirclaw_fallbacks_totalcounterTotal fallback events
nadirclaw_errors_totalcounterTotal errors
nadirclaw_uptime_secondsgaugeServer uptime in seconds

OpenTelemetry

Export traces to any OTLP-compatible backend:

~/.nadirclaw/.env
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

Grafana dashboard

Example Grafana dashboard provisioning config for NadirClaw metrics:

grafana-dashboard.json
{
  "dashboard": {
    "title": "NadirClaw",
    "panels": [
      {
        "title": "Requests / min",
        "type": "graph",
        "targets": [
          { "expr": "rate(nadirclaw_requests_total[1m])" }
        ]
      },
      {
        "title": "Cost / hour",
        "type": "stat",
        "targets": [
          { "expr": "increase(nadirclaw_cost_dollars_total[1h])" }
        ]
      },
      {
        "title": "Latency p95",
        "type": "graph",
        "targets": [
          { "expr": "histogram_quantile(0.95, rate(nadirclaw_request_latency_ms_bucket[5m]))" }
        ]
      },
      {
        "title": "Cache hit rate",
        "type": "gauge",
        "targets": [
          { "expr": "rate(nadirclaw_cache_hits_total[5m]) / rate(nadirclaw_requests_total[5m])" }
        ]
      }
    ]
  }
}

Pages on this site

Machine-readable summaries of this site: llms.txt and llms-full.txt.