eBPF (extended Berkeley Packet Filter) has revolutionized Linux observability by allowing safe, in-kernel instrumentation of system calls, network events, and process behavior. When combined with Prometheus, eBPF exporters provide deep performance metrics without the overhead of user-space sampling. This guide compares three prominent eBPF-based Prometheus exporters: Cloudflare’s ebpf_exporter, dswarbrick’s eBPF block I/O exporter, and DigitalOcean’s Go eBPF exporter.
What Are eBPF Prometheus Exporters?
Traditional monitoring tools like top, iostat, or vmstat sample system state at fixed intervals, missing short-lived events and adding measurement overhead. eBPF programs run inside the Linux kernel, attaching to tracepoints, kprobes, and uprobes to capture events as they happen. eBPF exporters aggregate these kernel-level events and expose them as Prometheus-compatible metrics at /metrics endpoints.
The key advantage: near-zero overhead. eBPF programs are JIT-compiled and run in a verified sandbox within the kernel. Metrics are aggregated in-kernel using eBPF maps, so only summary statistics (not raw events) are exported to user-space.
Cloudflare ebpf_exporter — Production-Grade Custom eBPF Metrics
cloudflare/ebpf_exporter (2,586 stars) is the most widely-used eBPF Prometheus exporter. Developed by Cloudflare’s infrastructure team, it provides a YAML-driven configuration system for defining custom eBPF programs and mapping their output to Prometheus metrics.
Installation
| |
Configuration
Cloudflare’s exporter ships with dozens of pre-built configs for common monitoring scenarios:
| |
Run with a pre-built config:
| |
Docker Compose Deployment
| |
Available Pre-Built Configs
The project includes configs for:
- biolatency — Block I/O latency histograms
- biosnoop — Per-process block I/O tracing
- cachestat — Page cache hit/miss ratios
- runqlat — CPU run queue latency
- tcpconnlat — TCP connection establishment latency
- tcpstates — TCP state transition tracking
- oomkill — OOM killer event tracking
- ext4dist — ext4 filesystem operation latency
dswarbrick eBPF Exporter — Specialized Block I/O Latency
dswarbrick/ebpf_exporter (76 stars) focuses specifically on block I/O latency measurement, providing detailed histograms of read and write latencies across all block devices. It is simpler than Cloudflare’s general-purpose exporter but offers deeper I/O analysis for storage-heavy workloads.
Installation
| |
Key Metrics
The exporter exposes these Prometheus metrics:
| Metric | Type | Description |
|---|---|---|
biodist_read_seconds | Histogram | Read latency distribution |
biodist_write_seconds | Histogram | Write latency distribution |
biodist_discard_seconds | Histogram | TRIM/discard latency |
biodist_flush_seconds | Histogram | Cache flush latency |
Docker Compose for I/O Monitoring
| |
DigitalOcean Go eBPF Exporter — Pure Go Implementation
digitalocean-labs/ebpf_exporter (29 stars) is a pure-Go eBPF exporter that uses the cilium/ebpf library instead of requiring clang/llvm toolchain dependencies. This makes it easier to build and deploy in environments where C compilation toolchains are not available.
Installation
| |
Advantages of Go-Based Approach
- No clang/LLVM dependency — uses cilium/ebpf for loading eBPF programs
- Cross-compilation —
GOOS=linux GOARCH=arm64 go buildproduces ARM64 binaries - Easier CI/CD — no need to install kernel headers and clang in build pipelines
- Type safety — Go’s struct-based eBPF map definitions reduce boilerplate
Docker Compose
| |
Comparison Table
| Feature | Cloudflare ebpf_exporter | dswarbrick eBPF | DigitalOcean Go eBPF |
|---|---|---|---|
| Stars | 2,586 | 76 | 29 |
| Language | Go + C (clang/LLVM) | Go + C (clang/LLVM) | Pure Go (cilium/ebpf) |
| Scope | General-purpose (many configs) | Block I/O focused | General-purpose |
| Pre-Built Configs | 30+ configs | 1 (block I/O) | ~10 configs |
| Metric Types | Histogram, Counter, Gauge | Histogram only | Histogram, Counter |
| Docker Support | Official image | Manual Dockerfile | Go build in container |
| BPF CO-RE | Yes | Yes | Yes |
| Kernel Requirements | 5.8+ (BPF CO-RE) | 5.8+ (BPF CO-RE) | 5.8+ (BPF CO-RE) |
| Build Dependencies | clang, LLVM, libbpf | clang, LLVM, libbpf | Go + libbpf headers |
| Best For | Production observability | Storage performance tuning | Go-centric environments |
Full Prometheus Stack with eBPF Monitoring
| |
Why Self-Host Your eBPF Monitoring?
Running your own eBPF exporter pipeline gives you kernel-level visibility that SaaS monitoring tools cannot provide. Cloud-based APM solutions rely on agent-based sampling or synthetic monitoring — they miss short-lived kernel events like page cache evictions, CPU scheduler delays, and storage I/O queue depths.
Cost efficiency is another factor. eBPF monitoring replaces multiple separate tools: you no longer need iostat, vmstat, pidstat, and custom shell scripts running every minute. A single eBPF exporter captures all these metrics with lower CPU overhead. For a fleet of 50 servers, eliminating 4-5 monitoring agents per host reduces memory footprint by 200-400 MB per server — 10-20 GB of RAM saved cluster-wide.
Data ownership matters for compliance-sensitive environments. eBPF traces capture detailed process behavior, file access patterns, and network connections. Sending this telemetry to a third-party SaaS creates a significant data governance surface. Self-hosted eBPF exporters keep all observability data within your infrastructure boundary.
For broader Prometheus monitoring setup, see our Prometheus vs Hertzbeat vs Netdata comparison. If you need eBPF tracing for debugging rather than metrics, our bpftrace vs BCC vs Sysdig guide covers the right tools. For complete observability platform comparisons, check our OpenObserve vs Quickwit vs Siglens article.
FAQ
What kernel version do I need for eBPF exporters?
All three exporters require Linux kernel 5.8 or newer for BPF CO-RE (Compile Once Run Everywhere) support. This feature allows eBPF programs to access kernel data structures without recompilation for each kernel version. Most modern distributions ship kernels 5.15+ (Ubuntu 22.04 LTS, Debian 12, RHEL 9).
Is it safe to run eBPF programs in production?
Yes. eBPF programs run in a verified sandbox — the kernel’s eBPF verifier checks every program for safety before loading. Programs cannot crash the kernel, access arbitrary memory, or run infinite loops. Cloudflare has run ebpf_exporter across thousands of production servers for years without stability issues.
What is the CPU overhead of eBPF exporters?
eBPF overhead is typically 0.1-1% CPU depending on the number of attached programs and event frequency. A single biolatency config adds negligible overhead because it only attaches to the block layer completion path. Running 5-10 configs simultaneously typically stays under 2% CPU — far less than running equivalent user-space monitoring scripts.
Can I run eBPF exporters in unprivileged containers?
No — loading eBPF programs requires CAP_SYS_ADMIN, CAP_BPF, and CAP_PERFMON capabilities. You can reduce the privilege surface by using CAP_BPF and CAP_PERFMON instead of full CAP_SYS_ADMIN, but some kernel versions require all three. The Docker Compose configs above use the minimal required capabilities.
Which exporter should I choose for a production environment?
For production use, Cloudflare’s ebpf_exporter is the clear choice — it has the most pre-built configs, active maintenance, and battle-tested deployment at Cloudflare scale. Use dswarbrick’s exporter only if you need specialized block I/O analysis beyond what Cloudflare’s biolatency config provides. The DigitalOcean Go exporter is best for teams with Go-centric build pipelines who want to avoid clang/LLVM dependencies.
How do I troubleshoot eBPF program load failures?
Common causes and fixes:
- “Operation not permitted” — ensure the container has
CAP_BPFandCAP_SYS_ADMIN - “Invalid argument” — kernel version may not support the eBPF helper functions used; upgrade kernel or use simpler configs
- “Program too large” — eBPF programs have a 1 million instruction limit; simplify complex configs
- “Failed to find BTF” — install
linux-headers-$(uname -r)andbpfcc-toolsfor BTF (BPF Type Format) data
Do eBPF exporters work with Kubernetes?
Yes. Deploy as a DaemonSet so each node runs an eBPF exporter pod. Use hostNetwork: true, hostPID: true, and appropriate security context capabilities. The Cilium and Falco projects use similar patterns for their eBPF-based networking and security tools.