Skip to content

Commit bd763f8

Browse files
authored
pyroscope.ebpf: otel profiler implementation (#2920)
1 parent 374cb37 commit bd763f8

File tree

16 files changed

+1103
-732
lines changed

16 files changed

+1103
-732
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
3232
--mount=type=cache,target=/go/pkg/mod \
3333
GOOS="$TARGETOS" GOARCH="$TARGETARCH" GOARM=${TARGETVARIANT#v} \
3434
RELEASE_BUILD=${RELEASE_BUILD} VERSION=${VERSION} \
35-
GO_TAGS="netgo builtinassets promtail_journal_enabled" \
35+
GO_TAGS="netgo builtinassets promtail_journal_enabled pyroscope_ebpf" \
3636
GOEXPERIMENT=${GOEXPERIMENT} \
3737
make alloy
3838

docs/sources/reference/components/pyroscope/pyroscope.ebpf.md

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,25 @@ title: pyroscope.ebpf
1515
`pyroscope.ebpf` configures an eBPF profiling job for the current host.
1616
The collected performance profiles are forwarded to the list of receivers passed in `forward_to`.
1717

18+
The `pyroscope.ebpf` component embeds the [`grafana/opentelemetry-ebpf-profiler`][] which is a fork of [`open-telemetry/opentelemetry-ebpf-profiler`][].
19+
20+
[`grafana/opentelemetry-ebpf-profiler`]: https://github.com/grafana/opentelemetry-ebpf-profiler
21+
[`open-telemetry/opentelemetry-ebpf-profiler`]: https://github.com/open-telemetry/opentelemetry-ebpf-profiler
22+
1823
{{< admonition type="note" >}}
1924
To use the `pyroscope.ebpf` component you must run {{< param "PRODUCT_NAME" >}} as root and inside the host PID namespace.
2025
{{< /admonition >}}
2126

27+
{{< admonition type="note" >}}
28+
The profiler requires file system storage at `/tmp/symb-cache` to store symbol cache data. Ensure this directory is accessible and has sufficient storage space.
29+
{{< /admonition >}}
30+
2231
You can specify multiple `pyroscope.ebpf` components by giving them different labels, however it's not recommended as it can lead to additional memory and CPU usage.
2332

2433
## Supported languages
2534

26-
This eBPF profiler only collects CPU profiles. Generally, natively compiled languages like C/C++, Go, and Rust are supported. Refer to [Troubleshooting unknown symbols][troubleshooting] for additional requirements.
27-
28-
Python is the only supported high-level language, as long as `python_enabled=true`.
29-
Other high-level languages like Java, Ruby, PHP, and JavaScript require additional work to show stack traces of methods in these languages correctly.
30-
Currently, the CPU usage for these languages is reported as belonging to the runtime's methods.
35+
- Native code (C/C++, Rust, Zig, Go, etc. without debug symbols on host)
36+
- Broad set of HLLs (Hotspot JVM, Python, Ruby, PHP, Node.JS, V8, Perl).
3137

3238
## Usage
3339

@@ -44,27 +50,36 @@ The component configures and starts a new eBPF profiling job to collect performa
4450

4551
You can use the following arguments with `pyroscope.ebpf`:
4652

47-
| Name | Type | Description | Default | Required |
48-
| ------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- |
49-
| `forward_to` | `list(ProfilesReceiver)` | List of receivers to send collected profiles to. | | yes |
50-
| `targets` | `list(map(string))` | List of targets to group profiles by container id | | yes |
51-
| `build_id_cache_size` | `int` | The size of the elf file build id -> symbols table LRU cache | `64` | no |
52-
| `collect_interval` | `duration` | How frequently to collect profiles | `"15s"` | no |
53-
| `collect_kernel_profile` | `bool` | A flag to enable/disable collection of kernelspace profiles | `true` | no |
54-
| `collect_user_profile` | `bool` | A flag to enable/disable collection of userspace profiles | `true` | no |
55-
| `container_id_cache_size` | `int` | The size of the PID -> container ID table LRU cache | `1024` | no |
56-
| `demangle` | `string` | C++ demangle mode. Available options are: `none`, `simplified`, `templates`, or `full` | `"none"` | no |
57-
| `go_table_fallback` | `bool` | A flag to enable symbol lookup in `.sym` / `.dynsym` sections when `.gopclntab` lookup failed. May be useful for `cgo` binaries. | `false` | no |
58-
| `pid_cache_size` | `int` | The size of the PID -> proc symbols table LRU cache | `32` | no |
59-
| `pid_map_size` | `int` | The size of eBPF PID map | `2048` | no |
60-
| `python_enabled` | `bool` | A flag to enable/disable python profiling | `true` | no |
61-
| `same_file_cache_size` | `int` | The size of the elf file -> symbols table LRU cache | `8` | no |
62-
| `sample_rate` | `int` | How many times per second to collect profile samples | `97` | no |
63-
| `symbols_map_size` | `int` | The size of eBPF symbols map | `16384` | no |
53+
| Name | Type | Description | Default | Required |
54+
|---------------------------|--------------------------|----------------------------------------------------------------------------------------------------------------------|----------|----------|
55+
| `forward_to` | `list(ProfilesReceiver)` | List of receivers to send collected profiles to. | | yes |
56+
| `targets` | `list(map(string))` | List of targets to group profiles by container ID. | | yes |
57+
| `build_id_cache_size` | `int` | Deprecated (no-op), previously controlled the size of the elf file build id -> symbols table LRU cache. | `64` | no |
58+
| `cache_rounds` | `int` | Deprecated (no-op), previously controlled the number of cache rounds. | | no |
59+
| `collect_interval` | `duration` | How frequently to collect profiles. | `"15s"` | no |
60+
| `collect_kernel_profile` | `bool` | Deprecated (no-op), previously enabled collection of kernelspace profiles. | `true` | no |
61+
| `collect_user_profile` | `bool` | Deprecated (no-op), previously enabled collection of userspace profiles. | `true` | no |
62+
| `container_id_cache_size` | `int` | The size of the PID -> container ID table LRU cache. | `1024` | no |
63+
| `demangle` | `string` | C++ demangle mode. Available options are: `none`, `simplified`, `templates`, or `full`. | `"none"` | no |
64+
| `dotnet_enabled` | `bool` | A flag to enable or disable .NET profiling. | `true` | no |
65+
| `go_table_fallback` | `bool` | Deprecated (no-op), previously enabled symbol lookup in `.sym` / `.dynsym` sections when `.gopclntab` lookup failed. | `false` | no |
66+
| `hotspot_enabled` | `bool` | A flag to enable ordisable hotspot profiling. | `true` | no |
67+
| `perl_enabled` | `bool` | A flag to enable or disable Perl profiling. | `true` | no |
68+
| `php_enabled` | `bool` | A flag to enable or disable PHP profiling. | `true` | no |
69+
| `pid_cache_size` | `int` | Deprecated (no-op), previously controlled the size of the PID -> proc symbols table LRU cache. | `32` | no |
70+
| `pid_map_size` | `int` | Deprecated (no-op), previously controlled the size of eBPF PID map. | `2048` | no |
71+
| `python_enabled` | `bool` | A flag to enable or disable python profiling. | `true` | no |
72+
| `ruby_enabled` | `bool` | A flag to enable or disable Ruby profiling. | `true` | no |
73+
| `same_file_cache_size` | `int` | Deprecated (no-op), previously controlled the size of the elf file -> symbols table LRU cache. | `8` | no |
74+
| `sample_rate` | `int` | How many times per second to collect profile samples. | `19` | no |
75+
| `symbols_map_size` | `int` | Deprecated (no-op), previously controlled the size of eBPF symbols map . | `16384` | no |
76+
| `v8_enabled` | `bool` | A flag to enable/disable V8 profiling. | `true` | no |
6477

6578
Only the `forward_to` and `targets` fields are required.
6679
Omitted fields take their default values.
6780

81+
Several arguments are marked as "Deprecated (no-op)". These arguments were previously used for configuring various cache sizes and behaviors, but they no longer have any effect. They are kept for backward compatibility but will be removed in a future release. It is recommended to remove these arguments from your configuration.
82+
6883
## Blocks
6984

7085
The `pyroscope.ebpf` component doesn't support any blocks. You can configure this component with arguments.

0 commit comments

Comments
 (0)