eBPF Observability: Telemetry From the Kernel, Not the Codebase

Every service in your estate is supposed to emit metrics and traces, and every SDK you deploy is a promise someone has to keep: pick the library, pin the version, wire the exporter, update it every time the platform team changes its mind, and do all of it for each language, in each repo, for each vendor app you can’t recompile. The instrumentation tax grows linearly with the number of services and squarily with the number of languages. eBPF offers a different bargain: run the observability from the kernel, leave the code untouched, and get RED metrics and traces out of processes that never heard of OpenTelemetry.

This post covers what eBPF actually is, how observability tools use it to extract HTTP and gRPC telemetry from unmodified applications, where the approach genuinely beats SDKs, and where it stops — because the limits are as concrete as the wins.

What eBPF actually is

eBPF (extended Berkeley Packet Filter) started as a packet-filtering VM and grew into a general mechanism for running sandboxed programs inside the Linux kernel — the eBPF Foundation’s overview covers the official landscape. You write a small program, attach it to an event source — a syscall entry (kprobe), a static tracepoint, a userspace function (uprobe), a network hook on XDP or TC — and the kernel runs it when that event fires. Before a program is loaded, the verifier statically proves it is safe: no null-pointer dereferences, no unbounded loops, no reads of arbitrary kernel memory, all paths terminating. If the verifier can’t prove safety, the program doesn’t load. That proof is what makes it sane to run third-party observability agents as root on production hosts.

Programs can’t write logs. They push data into maps — kernel-resident key/value structures the userspace agent reads. Modern tools use ring buffers (BPF_MAP_TYPE_RING_BUFFER, kernel 5.8+) to stream events like “a write() syscall returned 412 bytes to fd 17″ to userspace with minimal overhead. JIT compilation makes execution near-native; on any remotely current kernel this is single-digit percentage overhead territory, usually far less, concentrated on the events you attach to.

The portability story used to be the ugly part — programs recompiled per kernel version — but BPF Type Format (BTF) and compile-once-run-everywhere (CO-RE) relocations fixed most of it. Contemporary tooling targets recent LTS kernels and simply requires BTF to be present, which every major distribution has shipped for years.

How zero-code instrumentation works

Observability agents attach at two layers. First, syscalls: every HTTP request you’ll ever see ends in read()/write() (or sendto/recvfrom) on a socket. Attach probes there and you can correlate file descriptors to processes, assemble request/response pairs, and compute rate, errors, and duration per service — the RED metrics — for everything on the host.

Syscalls alone don’t give you HTTP semantics, though — TCP is a byte stream. So the second layer uses uprobes on well-known functions in the libraries every language uses: SSL_write/SSL_read in OpenSSL and BoringSSL, the request-writing functions in Go’s net/http, the equivalent entry points in Java, Node.js, Python, and .NET runtimes. When an application calls SSL_write with a buffer that parses as an HTTP request, the probe copies the bytes into a ring buffer, userspace parses the method, path, status code, and latency, and the agent emits an OpenTelemetry span. The application was never modified, restarted, or aware. Grafana’s Beyla works exactly this way: it produces RED metrics and trace spans for HTTP and gRPC traffic and exports them in OTLP and Prometheus formats.

In Kubernetes this runs as a privileged DaemonSet. The privilege list looks alarming until you know what each bit is for: BPF and PERFMON to load programs, SYS_PTRACE and DAC_READ_SEARCH to read process memory and ELF binaries so uprobes can find symbol offsets, hostPID to see all monitored processes. It is a security-sensitive deployment — a verifier-proof agent is still a root agent — which is why these tools ship as dedicated, auditable, minimal images rather than sidecars in every workload.

The hard part: trace context propagation

Metrics are easy; distributed traces are not. A trace stays connected because each service copies the traceparent header from inbound to outbound requests. The kernel sees bytes on the wire — but on modern services those bytes are TLS ciphertext, and the header lives in plaintext only inside the process, in memory the kernel can’t legitimately read without help.

eBPF agents solve this in two ways. The common one: attach uprobes to the TLS library functions themselves, and read the buffer after the application has already decrypted it — the plaintext HTTP headers pass through SSL_read/SSL_write, and the probe copies them there. The second, used when context is missing on the wire: inject the trace context at the kernel layer, tagging outgoing flows with the current span ID and having the receiving agent pick it up on the incoming flow — trading protocol fidelity for coverage. Neither approach is as robust as an SDK that owns the context explicitly; long-lived connections with request multiplexing, custom wire protocols, and non-TLS-library crypto all poke holes in it. Treat agent-generated traces as best-effort, SDK traces as authoritative.

What you get vs. what you give up

The genuine wins: coverage of things you can’t instrument at all — vendor appliances, third-party binaries, legacy services whose owners left, prototypes nobody wants to touch. Consistency across a polyglot fleet, because the agent doesn’t care what language the process is in. Zero onboarding latency: deploy the DaemonSet and the new microservice is on the dashboard before its first code review. And a bootstrapping function SDKs can’t do — seeing everything on a host is how you find the undocumented service calling your API from an IP nobody recognizes.

The give-ups: eBPF sees protocol-shaped traffic, not application semantics. No custom spans around a cache lookup, no business attributes, no visibility into internal queues, batchers, or retries inside the process — anything that doesn’t cross a syscall or a probed library function is invisible. Cloud-native runtimes are a mixed bag: serverless sandboxes with hardened seccomp profiles and some managed platforms don’t permit loading BPF programs at all. And the agent is an operational component with real kernel-version requirements, which is a different (and smaller, but nonzero) maintenance burden than the SDK upgrades it replaces.

The landscape has settled into recognizable shapes: Beyla for application RED metrics and traces exported to OpenTelemetry backends, bpftrace for ad-hoc kernel questions (the one-liner kprobe scripting tool that answers “which syscall is spinning?” in thirty seconds), Cilium Hubble for network-flow visibility between services, and continuous profilers built on perf-event probes for CPU flame graphs across an entire fleet without a single profiler SDK.

Wrapping up

eBPF observability is not a replacement for SDK instrumentation — it’s the floor underneath it. Deploy an agent first and every service instantly has RED metrics and baseline traces with no code changes; then add SDKs where semantic depth pays for itself: the revenue-critical checkout path, the batch jobs with internal retry loops, anything with business-level attributes you want on spans. Coverage for everyone, depth where it matters, and no more keeping twelve OpenTelemetry SDK versions in lockstep across a fleet.

Leave a Reply

Your email address will not be published. Required fields are marked *