Cloud Native & eBPF

STCLab details OpenTelemetry scaling fixes and measured eBPF overhead in production

Key Takeaway

Multi-replica OTel Collectors must label every counter writer and build RED metrics before tail sampling, and OpenTelemetry eBPF Instrumentation costs about 25% extra CPU time per request on a hot path.

Summary

STCLab's SRE team published a CNCF production post describing how it repaired its OpenTelemetry-based observability platform after discovering that its service graph reported 6,801 requests per second for an API whose SDK measured 26.2. The root cause was several gateway Collector replicas writing the same cumulative counter series without a distinguishing label, which made Prometheus-style rate() interpret interleaved samples as repeated resets. Span metrics had a second defect: they were generated after tail sampling, so RED metrics described kept traces rather than served traffic.

The team restructured the gateway into two stages inside the same pods, routing spans by trace ID to a headless Service, building service graph and span metrics before sampling, and adding a stable writer label derived from the StatefulSet pod name. It also audited cardinality, replacing full object-storage URLs with the route and cutting one service's series from 58,844 to about 1,200. The post then quantifies three eBPF layers: Cilium Hubble for L3/L4, OpenTelemetry eBPF Instrumentation (OBI) for HTTP spans, and Inspektor Gadget for on-demand deep inspection.

Collector topology, cardinality and eBPF cost measurements

  • Multi-writer counters: Gateway Collectors scaled from 3 to 20 replicas and each wrote the same cumulative series, so rate() saw resets; a stable writer label from the StatefulSet pod name plus sum over writer brought span metric rates within 1% of received spans.
  • Two-stage trace path: Stage 1 adds Kubernetes metadata and uses a load-balancing exporter keyed by trace ID to a headless Service; Stage 2 fans out to a pre-sampling service graph pipeline and a tail-sampling pipeline exporting to Tempo, with a second load-balancing exporter keyed by service and span name for span metrics.
  • Cardinality control: Full object-storage URLs as a span metrics dimension produced 58,844 series for one service, 20% of all active series; keeping only the route reduced it to roughly 1,200 and a day of cleanup removed 35% of active series.
  • OBI overhead: At about 2,400 req/s, CPU time per request rose from 41.6 to 51.8 microseconds (25%), with roughly two-thirds attributable to header tracking needed for the W3C traceparent header; sampling does not reduce probe cost because probes still run per request.
  • Blind spots and gadget cost: A SIGSTOP-frozen daemon resumed after 13 seconds produced a client timeout while OBI and the access log recorded a 0.125 ms 200 response, missing kernel queue wait; Inspektor Gadget's TCP tracer added 11% CPU per request and the CPU profiler 3%, and only 2 of 22 stacks resolved because the daemon lacks symbols and frame pointers.

Why it matters

The post gives operators concrete, reproducible guidance for running OpenTelemetry Collectors at scale: label every counter writer, generate RED metrics before tail sampling, and measure eBPF agent cost inside the application's cgroup rather than in the agent's own. It also sets realistic expectations for OBI adoption on latency-sensitive services, where a 25% per-request CPU increase can lower peak throughput, and shows why symbol and frame-pointer builds matter for profiler usefulness. For teams pairing telemetry with AI-driven alert investigation such as HolmesGPT, the cardinality and correctness fixes are a prerequisite, since an agent acts on a wrong number as confidently as a right one.

Original reference: www.cncf.io →