In late 2025 we discovered two serious gaps in our observability stack: duplicated counter series from a horizontally‑scaled collector service, and missing request telemetry for certain workloads. Both issues fed incorrect numbers into an AI‑driven investigation tool, prompting us to redesign the collector pipeline and to benchmark the CPU impact of eBPF‑based instrumentation.
Eliminating Counter Collisions in a Scaled Collector
Our gateway collectors ran behind a Kubernetes Service and were scaled from three to twenty pods. Each pod emitted cumulative counters without a distinguishing label, so Prometheus‑style rate() treated the interleaved writes as frequent resets, inflating request rates. The fix was to add a stable writer label derived from the StatefulSet pod name and to aggregate counters with sum by (writer). After the change, span‑metric rates aligned with the SDK‑reported traffic within one percent.
Two‑Stage Trace Routing to Preserve RED Metrics
Tail sampling had been applied before we generated RED (Rate‑Error‑Duration) metrics, causing those metrics to reflect only retained traces. We split the gateway pod into two logical stages. Stage 1 enriches spans with Kubernetes metadata and uses a load‑balancing exporter keyed by trace ID to route each trace to a single pod via a headless Service. Stage 2 fans the spans into two parallel pipelines: one builds the service‑graph metrics before any sampling, and the other performs tail sampling before exporting to Tempo. A second exporter, keyed by service and span name, ensures that span‑level metrics are also built pre‑sampling. This architecture restores metric fidelity while keeping storage costs low.
Cardinality Hygiene
A single dimension – full object‑storage URLs – generated 58,844 series for one service, accounting for roughly 20 % of all active series. By truncating the URL to its route component we reduced the series count to about 1,200, and a one‑day cleanup removed another 35 % of active series. The lesson is to audit high‑cardinality labels early and to prefer coarse‑grained identifiers when possible.
Measuring eBPF Cost Inside the Application cgroup
We evaluated three eBPF layers on a development copy of the daemon constrained to its production CPU limit. The always‑on Cilium Hubble layer records L3/L4 flows without HTTP visibility. Adding OpenTelemetry eBPF Instrumentation (OBI) turned HTTP traffic into spans linked to caller traces. Under a load of ~2,400 req/s, per‑request CPU time rose from 41.6 µs to 51.8 µs – a 25 % increase – with header parsing (traceparent) accounting for two‑thirds of the extra cost. Sampling reduced export volume but did not lower probe execution time because probes run on every request.
We also discovered a blind spot: when the daemon was paused with SIGSTOP, a client timed out after 10 s, yet OBI and the access log reported a 0.125 ms 200 response, because timing started on socket read and missed the kernel queue wait. Inspektor Gadget’s TCP tracer captured the stall, showing that a missing kernel‑level view can hide latency spikes that trigger liveness failures.
Running the TCP tracer in production added a median 11 % CPU overhead per request, while a CPU profiler added about 3 %. The daemon’s stripped binary without frame pointers limited stack‑trace usefulness, so we defer profiling until a symbol‑rich build is available. Each gadget run left a privileged debug pod; we mitigated this by adding automatic cleanup, tightening the pod’s role, and enforcing strict parameter validation.
Operational Guardrails
Hubble remains enabled cluster‑wide. High‑throughput core instances keep OBI disabled because a 25 % CPU hit is unacceptable for their hot path. OBI runs continuously on two low‑traffic API workloads, adding roughly 1 % of their CPU limit after a week‑long staging gate. During incidents, HolmesGPT triggers the TCP tracer for a 60‑second window, and engineers can widen OBI coverage for up to two hours via a time‑boxed pull request.
Related CloudNinjas coverage: hands-on guides.
What This Means For Practitioners
When scaling collectors, always label the writer identity and aggregate over that label to avoid false resets. Build metrics before any sampling step to keep RED numbers truthful. Audit label cardinality aggressively; a single high‑cardinality dimension can dominate your series budget. Measure eBPF overhead inside the target cgroup, not just the agent process, because probes execute in the application thread. Finally, validate what each observability tool does not capture – for example, kernel queue delays – before relying on its output in automated decision‑making.
