Skip to content
Docs

Observability and Telemetry

OpenTelemetry: OTLP (default), Jaeger, Zipkin, Console exporters. OTel export is opt-in (off by default). When enabled (since 2.0.411), every gateway call — chat, streaming, embeddings, relay, MCP and blocked requests — is exported as one span (model, provider, tenant, tokens, cost, status) plus request/token/cost/latency metrics; the exporter configuration is in place for OTLP-compatible backends:

  • Tracing: Jaeger, Grafana Tempo, Datadog APM, Honeycomb, New Relic, AWS X-Ray
  • Metrics: Prometheus (scrape /metrics?format=prometheus), Datadog, Grafana Cloud, New Relic
  • Logs: ELK (Elasticsearch + Logstash + Kibana), Splunk, Grafana Loki, Datadog Logs

W3C Trace Context (since 2.0.412): the gateway joins the caller’s distributed trace. A request carrying a valid traceparent (version 00, lowercase hex, non-zero ids) has its trace id adopted; otherwise the gateway starts a new trace. Malformed values are ignored, never forwarded. Every upstream call the gateway makes for that request — chat (streaming and non-streaming, including Vertex and keyless Bedrock), embeddings/images/audio, the transparent and generic relays, gateway-route forwarding and MCP tool calls — carries traceparent with the request’s trace id and the gateway’s own span id, plus the caller’s tracestate when valid (≤512 chars, ≤32 members). The exported OTel span uses that trace id and span id with the caller’s span as its parent, so caller → gateway → provider appear as one trace; a caller-sampled trace is recorded regardless of the local sample rate. The trace id is returned in the X-AgentWatch-Trace-Id response header and stamped on every usage row as the trace_id tag (filterable in the Audit Trail). Outbound injection can be disabled with AW_TRACE_PROPAGATION=0. Langfuse: opt-in. When enabled (since 2.0.411), every gateway call becomes a Langfuse trace + generation carrying model, tokens, status and the same prompt/response previews the usage row stores (already scrubbed for DLP-actioned requests; full bodies are never exported). Prometheus: GET /metrics?format=prometheus (the default /metrics response is JSON) — counters, gauges, histograms, system metrics (latency histograms, token counts per model, success/error rates, queue depths, circuit-breaker state). Usage: Per-request tokens, cost, duration, TTFT, sessionId, model, provider, team, user — filterable/aggregatable by any metadata tag (Section 22 events). Real-time + historical with configurable alert thresholds. Structured events: when the event pipeline is running, every completed request emits an llm.request.complete event with request_id, session_id, tenant_id, organization_id, team_id, model, provider, status, latency_ms, ttft_ms, prompt_tokens, completion_tokens, cost_usd. Prompt/response previews in these events get basic PII masking (email/phone/SSN/card) when PII redaction is enabled for capture. Separate streams: authentication events are stored in AuthEvent and DLP verdicts in DlpEvent; on Kafka, auth and DLP events have their own topics, while rate-limit and budget events share the system-events topic. Audit: Flat-file ndjson.gz per org, CSV / JSON export, LLM-powered analysis (Admin Insights), SIEM export via Kafka or webhooks. Full conversation history: every request is captured with full prompt + response transcript (DLP-redacted per policy), browsable per employee, per team, or per session — answers “what did this user actually ask Claude this morning?” without needing to scrape logs. AI task auto-categorization: every LLM request is classified at the gateway into broad task categories — Code, Content, Data Analysis, plus extensible custom categories — so usage reports can show “60% of last quarter’s GPT-4 spend went to Code Generation, 25% to Content, 15% to Data Analysis.” Categorization is metadata only, captured alongside tokens and cost in the same event. Performance graphs + analytics leaderboards: out-of-the-box dashboards rank teams and employees by spend, request volume, tokens-per-dollar efficiency, and month-over-month growth — useful for FinOps reviews and for identifying internal champions or runaway costs early.

21.1 AI Insights — Natural-Language Query over Audit Data

Section titled “21.1 AI Insights — Natural-Language Query over Audit Data”

AgentWatch ships a built-in LLM-powered analytics interface that lets non-technical administrators ask questions of the audit + usage data in plain English. Conversations persist in the insights_conversations table so the analyst can resume a thread, share it with a teammate, and audit who-asked-what (multi-turn natural-language analytics with thread history). Ten endpoints under /api/admin/insights/… cover chat (streaming + non-streaming), conversation list/get/delete, and initialization. Backed by a RAG pipeline over the conversation/audit/event store, it answers questions like:

  • “Which teams’ Claude usage grew more than 50% last month?”
  • “Show me every employee who triggered a DLP violation in the last 30 days, grouped by category.”
  • “What’s the highest-cost prompt my organization sent yesterday and which model handled it?”
  • “Which application is responsible for the spike in 429 responses this morning?”

Configurable to use any approved upstream model (Ollama first for sovereign deployments, Anthropic or OpenAI for SaaS). Trend detection and anomaly identification flag deviations from baseline automatically. The interface is designed for compliance officers, FinOps analysts, and engineering managers — not for engineers writing SQL.