MCPcopy
hub / github.com/open-telemetry/opentelemetry-ebpf-profiler

github.com/open-telemetry/opentelemetry-ebpf-profiler @v0.0.202627 sqlite

repository ↗ · DeepWiki ↗ · release v0.0.202627 ↗
2,303 symbols 8,527 edges 372 files 1,206 documented · 52%
README

OpenTelemetry eBPF Profiler

This repository implements a whole-system, cross-language profiler for Linux via eBPF.

Core features and strengths

  • Implements the Alpha OTel Profiles signal
  • Very low CPU and memory overhead (1% CPU and 250MB memory are our upper limits in testing and the agent typically manages to stay way below that)
  • Support for native C/C++ executables without the need for DWARF debug information (by leveraging .eh_frame data as described in US11604718B1)
  • Support profiling of system libraries without frame pointers and without debug symbols on the host.
  • Support for mixed stacktraces between runtimes - stacktraces go from Kernel space through unmodified system libraries all the way into high-level languages.
  • Support for native code (C/C++, Rust, Zig, Go, etc. without debug symbols on host)
  • Support for a broad set of HLLs, like Hotspot JVM, Python, Ruby, PHP, Node.JS, V8, Perl, Erlang and .NET.
  • 100% non-intrusive: there's no need to load agents or libraries into the processes that are being profiled.
  • No need for any reconfiguration, instrumentation or restarts of HLL interpreters and VMs: the agent supports unwinding each of the supported languages in the default configuration.
  • ARM64 support for all unwinders.
  • Support for native inline frames, which provide insights into compiler optimizations and offer a higher precision of function call chains.

Supported Linux kernel version

The minimum required Linux kernel version has increased with certain commits. Specifically:

  • Commit 8047150e was the last to support kernel version 5.4. Subsequent changes may require a minimal Linux kernel version of 5.10 or greater.
  • Commit 7ddc23ea was the last to support kernel version 4.19. Subsequent changes may require a minimal Linux kernel version of at least 5.4.

Updating the supported Linux kernel version

The project maintains its minimum supported kernel version in line with the lowest kernel version currently provided by actively maintained major Linux distributions, which include Debian stable, Red Hat Enterprise Linux, Ubuntu LTS, Amazon Linux and SUSE Linux. The minimum requirement may be increased when all such distributions no longer ship a specific kernel version. This approach enables the codebase to utilize newer eBPF features and avoids the need to maintain compatibility shims for obsolete kernels.

It should be noted that certain distributions incorporate eBPF features from newer kernels into their supported versions. When this occurs, the distribution's stated kernel version does not accurately reflect its true eBPF capabilities and will not prevent us from increasing the minimum supported version. On such kernels, the no-kernel-version-check configuration option can be used to bypass the checks and allow the profiler to execute.

Building

We have integrated the profiler into the OTel Collector as a receiver, and this is the supported configuration going forward.

To aid with development, testing and debugging, we also offer a standalone profiling agent binary named ebpf-profiler, and a local build of an OTel Collector profiling receiver binary (otelcol-ebpf-profiler). These binaries are not supported in any way, can be dropped in the future and should not be deployed in production.

Platform Requirements

The agent can be built with the provided make targets. Docker is required for containerized builds, and both amd64 and arm64 architectures are supported.

For Linux, the following steps apply: 1. Build the agent for your current machine's architecture: sh make agent 2. To cross-compile for a different architecture (e.g. arm64): sh make agent TARGET_ARCH=arm64 The resulting binary will be named ebpf-profiler in the current directory.

Other OSes

Since the profiler is Linux-only, macOS and Windows users need to set up a Linux VM to build and run the agent. Ensure the appropriate architecture is specified if using cross-compilation. Use the same make targets as above after the Linux environment is configured in the VM.

Alternative Build (Without Docker)

You can build the agent without Docker by directly installing the dependencies listed in the Dockerfile. Once dependencies are set up, simply run:

make

This will build the profiler natively on your machine.

Building otelcol-ebpf-profiler locally (Without Docker)

You can build the local otelcol-ebpf-profiler binary by running:

make otelcol-ebpf-profiler

or to cross-compile for a different architecture (e.g. arm64):

make otelcol-ebpf-profiler TARGET_ARCH=arm64

See local.example.yaml for an example configuration.

Running

You can start the agent with the following command:

sudo ./ebpf-profiler -collection-agent=127.0.0.1:11000 -disable-tls

To start the OTel Collector profiling receiver, run:

sudo ./otelcol-ebpf-profiler --feature-gates=+service.profilesSupport --config cmd/otelcol-ebpf-profiler/local.example.yaml

The agent comes with a functional but work-in-progress / evolving implementation of the recently released Alpha OTel Profiles signal.

The agent loads the eBPF program and its maps, starts unwinding and reports captured traces to the backend.

Open Source Backends

As the OTel Profiles signal is still in development, mature production-ready backends have yet to emerge. The following open source projects can be used as backends:

  • devfiler — to speed up development and experimentation, Elastic has open-sourced a desktop application that reimplements the backend (collection, data storage, symbolization and UI) portion of the eBPF profiler. Note that devfiler is not a real production backend and should not be used as such. It is solely aimed at testing, experimentation and development.
  • Pyroscope — an open source continuous profiling database that natively supports ingesting OTel profiling data.

Development

To understand how this project works and learn more about profiling, check out Profiling internals

Contributing

Emeritus

For more information about the emeritus role, see the community repository.

Legal

Licensing Information

This project is licensed under the Apache License 2.0 (Apache-2.0). Apache License 2.0

The eBPF source code is licensed under the GPL 2.0 license. GPL 2.0

Licenses of dependencies

To display a summary of the dependencies' licenses:

make legal

Extension points exported contracts — how you extend this code

Expression (Interface)
Expression is an interface representing a 64-bit size value. It can be immediate [6 implementers]
asm/expression/expression.go
Data (Interface)
Data is the interface to operate on per-ELF DSO data. [13 implementers]
interpreter/types.go
ELFOpener (Interface)
import "go.opentelemetry.io/ebpf-profiler/libpf/pfelf" ELFOpener is the interface to open ELF files from arbitrary locat [7 …
libpf/pfelf/elfopener.go
EbpfHandler (Interface)
EbpfHandler provides the functionality to interact with eBPF maps. [3 implementers]
processmanager/ebpfapi/ebpf.go
Intervals (Interface)
Intervals is a subset of config.IntervalsAndTimers. [3 implementers]
tracer/tracer.go
CodeGen (Interface)
CodeGen describes the interface to be implemented by each code-generator. [2 implementers]
tools/errors-codegen/main.go
Reporter (Interface)
Reporter is the top-level interface implemented by a full reporter. [2 implementers]
reporter/iface.go
Process (Interface)
Process is the interface to inspect ELF coredump/process. The current implementations do not allow concurrent access to [2 …
process/types.go

Core symbols most depended-on inside this repo

Equal
called by 297
libpf/fileid.go
Debugf
called by 154
internal/log/logging.go
Ptr
called by 140
interpreter/dotnet/nibblereader.go
Intern
called by 114
libpf/string.go
Add
called by 96
metrics/types.go
Read
called by 82
interpreter/dotnet/cachingreader.go
Uint32
called by 72
interpreter/dotnet/nibblereader.go
Uint64
called by 67
remotememory/remotememory.go

Shape

Method 949
Function 931
Struct 308
TypeAlias 78
Interface 20
Class 11
FuncType 6

Languages

Go96%
Python1%
Java1%
TypeScript1%

Modules by API surface

nativeunwind/elfunwindinfo/elfehframe.go60 symbols
interpreter/nodev8/v8.go59 symbols
libpf/pfelf/file.go57 symbols
processmanager/processinfo_test.go48 symbols
interpreter/dotnet/pe.go44 symbols
tracer/tracer.go41 symbols
processmanager/ebpf/ebpf.go36 symbols
nativeunwind/elfunwindinfo/elfgopclntab.go34 symbols
LICENSES/github.com/hashicorp/go-version/version.go33 symbols
process/coredump.go30 symbols
kallsyms/kallsyms.go30 symbols
interpreter/ruby/ruby.go28 symbols

Dependencies from manifests, versioned

4d63.com/gocheckcompilerdirectivesv1.3.0 · 1×
4d63.com/gochecknoglobalsv0.2.2 · 1×
charm.land/lipgloss/v2v2.0.3 · 1×
codeberg.org/chavacava/garifv0.2.0 · 1×
codeberg.org/polyfloyd/go-errorlintv1.9.0 · 1×
dev.gaijin.team/go/exhaustruct/v4v4.0.0 · 1×
dev.gaijin.team/go/golibv0.6.0 · 1×
github.com/4meepo/tagalignv1.4.3 · 1×
github.com/Abirdcfly/dupwordv0.1.7 · 1×
github.com/AdminBenni/iota-mixingv1.0.0 · 1×
github.com/AlwxSin/noinlineerrv1.0.5 · 1×
github.com/Antonboom/errnamev1.1.1 · 1×

For agents

$ claude mcp add opentelemetry-ebpf-profiler \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact