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
| Metric | Type | Description |
|---|---|---|
nadirclaw_requests_total | counter | Total requests processed |
nadirclaw_tokens_prompt_total | counter | Total prompt tokens |
nadirclaw_tokens_completion_total | counter | Total completion tokens |
nadirclaw_cost_dollars_total | counter | Total cost in USD |
nadirclaw_request_latency_ms | histogram | Request latency in milliseconds |
nadirclaw_cache_hits_total | counter | Total cache hits |
nadirclaw_fallbacks_total | counter | Total fallback events |
nadirclaw_errors_total | counter | Total errors |
nadirclaw_uptime_seconds | gauge | Server 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])" }
]
}
]
}
}