
eBPF Overhead in Production: OpenTelemetry Lessons From STCLab
Cloud Platform EngineeringAt about 2,400 requests per second, OpenTelemetry’s eBPF instrumentation raised CPU time per request from 41.6 to 51.8 µs, a 25% increase, on a C daemon STCLab’s SRE team tested, according to the team’s CNCF post. For platform teams who treat eBPF as free, zero-code telemetry, the finding cuts both ways: it works without touching the app, but it isn’t free, and sampling doesn’t make it cheaper.
How It Works
STCLab runs an OpenTelemetry platform on a central LGTM backend (Loki, Grafana, Tempo and Mimir), which an AI agent, HolmesGPT, uses to investigate alerts. Its first problem was wrong numbers. Gateway Collectors behind a Kubernetes Service scaled from 3 to 20 replicas, and the service graph showed one API at 6,801 requests per second while the application SDK showed 26.2.
The cause was mechanical. Several replicas wrote the same cumulative counter series with no label to tell them apart, so rate() read the interleaved values as repeated counter resets. Span metrics were also generated after tail sampling, so RED metrics described kept traces, not real traffic. The fix was a two-stage path inside the same pods: a load-balancing exporter keyed by trace ID routes spans to a headless Service, then one pipeline builds the service graph before sampling while another samples and exports to Tempo. Every multi-writer series now carries a stable writer label from the StatefulSet pod name, and span metric rates match received spans within 1%.
Cardinality was the second leak. Full object-storage URLs as one dimension created 58,844 series for a single service, 20% of active production series. Keeping the route instead cut that to about 1,200, and a day of cleanup reduced active series by 35%.
The eBPF test targeted a compiled C traffic-control daemon that would need code changes for an SDK. The team compared three layers: Cilium Hubble for L3/L4 flows, OpenTelemetry eBPF Instrumentation (OBI) for HTTP spans, and Inspektor Gadget for on-demand inspection. It toggled OBI off and on under equal load and read CPU time per request from the container’s cgroup counters. About two-thirds of the 25% came from header tracking, which OBI needs to read the W3C traceparent header and which is off by default.
OBI also missed a stall. With the daemon frozen for 13 seconds, the client timed out, yet OBI and the access log recorded a 0.125 ms 200 response, because timing starts at the socket read. Inspektor Gadget’s TCP tracer caught it, but only because it was already running.
What This Means for You
STCLab’s production setup follows its numbers. Hubble runs everywhere. High-traffic core instances stay uninstrumented, because “a 25% hit is too much for their hot path.” OBI runs continuously on two low-traffic workloads, adding about 1% of their CPU limit after a one-week staging gate. During incidents, HolmesGPT runs the TCP tracer for 60 seconds, which added 11% to CPU time per request in testing, against 3% for the CPU profiler. These are one company’s measurements on one daemon. Our look at AWS’s OpenTelemetry pipeline for agent observability covers a managed take on the same plumbing.
The So What
If you’re rolling out eBPF instrumentation, measure CPU time per request inside the application’s own cgroup before enabling it on hot paths, keep header tracking off unless you need trace propagation, and add a stable writer label to any metric series written by scaled Collectors, because STCLab’s inflated service graph came from exactly that missing label.
Source: CNCF Blog
Content created with AI assistance and reviewed for accuracy.
Join the conversation
Stack Insiders is our free community for readers who want to go deeper — share resources, ask questions, and connect with others across every vertical we cover.
Join Stack Insiders →