Why the data had to get better
In December 2025 we shared how we built an observability platform with OpenTelemetry (OTel) and a central LGTM backend (Loki, Grafana, Tempo, Mimir). In our second post, we introduced HolmesGPT, an AI agent that investigates alerts using those same metrics, logs, and traces. A wrong number used to mislead a dashboard; now it can steer an automated investigation.
Two gaps became urgent: some numbers were wrong, and some workloads produced no request telemetry at all.
When the numbers lie
Our gateway Collectors sat behind a Kubernetes Service, scaling from 3 to 20 replicas. Each replica received spans, tail sampled them, and generated span and service graph metrics.
The service graph showed one API handling 6,801 requests per second while the app SDK showed 26.2. Multiple replicas were writing the same cumulative counter series without a distinguishing label, so Prometheus-style rate() read the interleaving as repeated resets. Span metrics had a quieter bug: generated after tail sampling, our RED metrics reflected kept traces rather than served traffic.
We split the gateway into two stages inside the same pods. Stage 1 adds Kubernetes metadata and uses a load-balancing exporter to route spans by trace ID to a headless Service, landing each trace on one pod. Stage 2 fans span out to two pipelines: one builds the service graph before sampling, and the other tail samples and exports to Tempo. Span metrics use a second load-balancing exporter keyed by service and span name, so both metrics are built before sampling.
Figure 1. Two-stage trace path inside the same gateway pods.
Every multi-writer series now carries a stable writer label from the StatefulSet pod name, and queries sum over writer. Span metric rates now match received spans within 1%.
We also audited cardinality. One span metrics dimension—full object-storage URLs—created 58,844 series for a single service, 20% of all active series in production. Keeping the route instead cut it to about 1,200, and a day of cleanup reduced active series by 35%.
Three eBPF layers, measured first
Instrumenting our traffic-control core, a compiled C daemon, with an SDK meant code changes and extra work for the development team. To get request telemetry faster without touching the daemon, we turned to eBPF—knowing kernel probes still burn CPU, and wanting to see where that cost lands. We measured each tool on a dev copy of the daemon with production’s CPU limit.
Figure 2. Three eBPF layers, each measured before production.
Network, always on. Cilium Hubble records L3/L4 flows, drops, and resets across every cluster, production included. In our L3/L4-only setup, it does not see HTTP, where the next layer starts.
Requests, selectively. OpenTelemetry eBPF Instrumentation (OBI) turned the daemon’s HTTP traffic into spans linked to callers’ traces. Alternating OBI off and on under equal load, we measured the daemon’s CPU time per request from container cgroup counters. At ~2,400 req/s, CPU time rose from 41.6 to 51.8 µs, by 25%, growing with load and lowering peak throughput. About two-thirds came from header tracking—needed to read the W3C traceparent header and off by default. Sampling did not help: it cuts exports, but probes still run on every request. Separately, OBI captures full query strings; because our URLs carry session tokens, the Collector strips them before storage.
Next, we tested what OBI misses. We froze the daemon with SIGSTOP, sent a request with a 10-second client timeout, and resumed it 13 seconds later. The client timed out, yet OBI and the access log both recorded a 0.125 ms 200 response—both start timing on socket read, missing kernel queue wait. Inspektor Gadget’s TCP tracer caught the stall (health-check connections waited up to 12.6 seconds to be accepted), but only because it was already running. A stall ending before an alert leaves few clues: caller timeouts, liveness failures, and—when CPU limits cause it—throttling. Pushing load to the CPU limit triggered liveness timeouts and restarts before throughput flattened.
Deep inspection, on demand. Inspektor Gadget runs as a HolmesGPT toolset in dev and staging, and in production with only the TCP tracer; trimming output fields cut per-run agent tokens by 82%. Under the same load, the CPU profiler added a median 3% to the daemon’s CPU time per request, and the TCP tracer added 11%. Because the daemon is stripped and built without frame pointers, only 2 of 22 stacks in a 30-second sample had a function name and none showed a caller—so the profiler stays out of production until the daemon is rebuilt with symbols and frame pointers. Gadgets unload cleanly, but each run leaves behind a privileged debug pod, so before production we added cleanup, a narrower role, and strict parameter validation.
What runs in production. Hubble stays on everywhere. High-traffic core instances stay uninstrumented—a 25% hit is too much for their hot path—while OBI runs continuously on two low-traffic workloads our API calls, adding ~1% of their CPU limit in the workload’s cgroup after a one-week staging gate. During incidents, HolmesGPT runs the TCP tracer for 60 seconds, and engineers can widen OBI for two hours via a time-boxed pull request. When docs left questions open, such as when OBI starts a span, we read the open source code and tested it.
What we’d tell another team
Here’s what we’d pass on to another team taking a similar path:
- Count every counter’s writers. If multiple Collectors write a series, add a stable writer label and sum over it.
- Generate metrics before sampling. Tail sampling saves storage, but RED metrics must reflect all served traffic.
- Measure eBPF inside the app’s cgroup. Probes run in app threads, so the agent’s own CPU hides the real cost.
- Test what a tool misses before deploying. Freeze a process and verify which signal actually notices.
- Remember who reads your telemetry. An AI agent acts on a wrong number as confidently as a right one.