-
Notifications
You must be signed in to change notification settings - Fork 584
pyroscope.ebpf: otel profiler implementation #2920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4846a04
ca84882
f30538b
afb4561
8d31d67
0b5a7af
de05df5
d0b5167
79ac6f1
f4704c4
17cfb0f
6f04247
e17b5d6
17d013e
84e266a
1449494
b205f65
79b4df6
c2bc065
38cf014
35af2d9
60cc204
15281fe
6c87c1a
f201df7
6cdbdb4
7e4b5fc
2f80a01
e748eef
e87fe4e
a0d2a7c
d05a31d
298c55f
0f95485
c604b2f
c0a52bb
ec296a8
aaea20e
5a699d6
6d338ac
5a51cdf
5dbaf2d
5bf3ab9
e0bf597
29a4039
943345a
749f10e
845fd7e
6f51fa5
df50394
a9c32e4
f732425
bcb76be
c2a10ad
625a50b
31eb2f8
091cf26
9dbe9fe
c5cf7b8
21cdd37
f92c399
d6778fe
b80a7b4
4343497
cd10b20
9892ce7
d3163b9
b4d2a96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,19 +15,25 @@ title: pyroscope.ebpf | |
| `pyroscope.ebpf` configures an eBPF profiling job for the current host. | ||
| The collected performance profiles are forwarded to the list of receivers passed in `forward_to`. | ||
|
|
||
| The `pyroscope.ebpf` component embeds the [`grafana/opentelemetry-ebpf-profiler`][] which is a fork of [`open-telemetry/opentelemetry-ebpf-profiler`][]. | ||
|
|
||
| [`grafana/opentelemetry-ebpf-profiler`]: https://github.com/grafana/opentelemetry-ebpf-profiler | ||
| [`open-telemetry/opentelemetry-ebpf-profiler`]: https://github.com/open-telemetry/opentelemetry-ebpf-profiler | ||
|
|
||
| {{< admonition type="note" >}} | ||
| To use the `pyroscope.ebpf` component you must run {{< param "PRODUCT_NAME" >}} as root and inside the host PID namespace. | ||
| {{< /admonition >}} | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it make sense to add a note pointing to the underlying profiler being used?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've done that in other component docs - example: https://grafana.com/docs/alloy/latest/reference/components/prometheus/prometheus.exporter.windows/
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added links 6cdbdb4 |
||
| {{< admonition type="note" >}} | ||
| 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. | ||
| {{< /admonition >}} | ||
|
|
||
| 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. | ||
|
|
||
| ## Supported languages | ||
|
|
||
| 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. | ||
|
|
||
| Python is the only supported high-level language, as long as `python_enabled=true`. | ||
| Other high-level languages like Java, Ruby, PHP, and JavaScript require additional work to show stack traces of methods in these languages correctly. | ||
| Currently, the CPU usage for these languages is reported as belonging to the runtime's methods. | ||
| - Native code (C/C++, Rust, Zig, Go, etc. without debug symbols on host) | ||
| - Broad set of HLLs (Hotspot JVM, Python, Ruby, PHP, Node.JS, V8, Perl). | ||
|
|
||
| ## Usage | ||
|
|
||
|
|
@@ -44,27 +50,36 @@ The component configures and starts a new eBPF profiling job to collect performa | |
|
|
||
| You can use the following arguments with `pyroscope.ebpf`: | ||
|
|
||
| | Name | Type | Description | Default | Required | | ||
| | ------------------------- | ------------------------ | -------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- | | ||
| | `forward_to` | `list(ProfilesReceiver)` | List of receivers to send collected profiles to. | | yes | | ||
| | `targets` | `list(map(string))` | List of targets to group profiles by container id | | yes | | ||
| | `build_id_cache_size` | `int` | The size of the elf file build id -> symbols table LRU cache | `64` | no | | ||
| | `collect_interval` | `duration` | How frequently to collect profiles | `"15s"` | no | | ||
| | `collect_kernel_profile` | `bool` | A flag to enable/disable collection of kernelspace profiles | `true` | no | | ||
| | `collect_user_profile` | `bool` | A flag to enable/disable collection of userspace profiles | `true` | no | | ||
| | `container_id_cache_size` | `int` | The size of the PID -> container ID table LRU cache | `1024` | no | | ||
| | `demangle` | `string` | C++ demangle mode. Available options are: `none`, `simplified`, `templates`, or `full` | `"none"` | no | | ||
| | `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 | | ||
| | `pid_cache_size` | `int` | The size of the PID -> proc symbols table LRU cache | `32` | no | | ||
| | `pid_map_size` | `int` | The size of eBPF PID map | `2048` | no | | ||
| | `python_enabled` | `bool` | A flag to enable/disable python profiling | `true` | no | | ||
| | `same_file_cache_size` | `int` | The size of the elf file -> symbols table LRU cache | `8` | no | | ||
| | `sample_rate` | `int` | How many times per second to collect profile samples | `97` | no | | ||
| | `symbols_map_size` | `int` | The size of eBPF symbols map | `16384` | no | | ||
| | Name | Type | Description | Default | Required | | ||
| |---------------------------|--------------------------|----------------------------------------------------------------------------------------------------------------------|----------|----------| | ||
| | `forward_to` | `list(ProfilesReceiver)` | List of receivers to send collected profiles to. | | yes | | ||
| | `targets` | `list(map(string))` | List of targets to group profiles by container ID. | | yes | | ||
| | `build_id_cache_size` | `int` | Deprecated (no-op), previously controlled the size of the elf file build id -> symbols table LRU cache. | `64` | no | | ||
| | `cache_rounds` | `int` | Deprecated (no-op), previously controlled the number of cache rounds. | | no | | ||
| | `collect_interval` | `duration` | How frequently to collect profiles. | `"15s"` | no | | ||
| | `collect_kernel_profile` | `bool` | Deprecated (no-op), previously enabled collection of kernelspace profiles. | `true` | no | | ||
| | `collect_user_profile` | `bool` | Deprecated (no-op), previously enabled collection of userspace profiles. | `true` | no | | ||
| | `container_id_cache_size` | `int` | The size of the PID -> container ID table LRU cache. | `1024` | no | | ||
| | `demangle` | `string` | C++ demangle mode. Available options are: `none`, `simplified`, `templates`, or `full`. | `"none"` | no | | ||
| | `dotnet_enabled` | `bool` | A flag to enable or disable .NET profiling. | `true` | no | | ||
| | `go_table_fallback` | `bool` | Deprecated (no-op), previously enabled symbol lookup in `.sym` / `.dynsym` sections when `.gopclntab` lookup failed. | `false` | no | | ||
| | `hotspot_enabled` | `bool` | A flag to enable ordisable hotspot profiling. | `true` | no | | ||
| | `perl_enabled` | `bool` | A flag to enable or disable Perl profiling. | `true` | no | | ||
| | `php_enabled` | `bool` | A flag to enable or disable PHP profiling. | `true` | no | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current revision of the go consumes shit ton of memory and cpu and it works much better without it (i.e. using our symbolizer). We may want to add go here after we update our fork to include open-telemetry/opentelemetry-ebpf-profiler#456 which is not straightforward because it removes the rust lib and we rely on it. tldr - yes, but later. |
||
| | `pid_cache_size` | `int` | Deprecated (no-op), previously controlled the size of the PID -> proc symbols table LRU cache. | `32` | no | | ||
| | `pid_map_size` | `int` | Deprecated (no-op), previously controlled the size of eBPF PID map. | `2048` | no | | ||
| | `python_enabled` | `bool` | A flag to enable or disable python profiling. | `true` | no | | ||
| | `ruby_enabled` | `bool` | A flag to enable or disable Ruby profiling. | `true` | no | | ||
| | `same_file_cache_size` | `int` | Deprecated (no-op), previously controlled the size of the elf file -> symbols table LRU cache. | `8` | no | | ||
| | `sample_rate` | `int` | How many times per second to collect profile samples. | `19` | no | | ||
| | `symbols_map_size` | `int` | Deprecated (no-op), previously controlled the size of eBPF symbols map . | `16384` | no | | ||
| | `v8_enabled` | `bool` | A flag to enable/disable V8 profiling. | `true` | no | | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be good to also pass through
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the one hand I like this idea, but on the other I want to introduce as little arguments as possible. It is currently possible to enable this flag through env variable. I'd prefer to keep it an undocumented debugging-facility feature. WDYT? |
||
| Only the `forward_to` and `targets` fields are required. | ||
| Omitted fields take their default values. | ||
|
|
||
| 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. | ||
|
|
||
| ## Blocks | ||
|
|
||
| The `pyroscope.ebpf` component doesn't support any blocks. You can configure this component with arguments. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploying that using the helm chart, I am getting this error:
This fixes it:
I think as this change might be quite disruptive, we maybe also should investigate, if we do that when the folder is not mounted:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can try mounting it ourselves. We're superuser afterall. I remember I did this in a branch for convenience.
https://github.com/grafana/pyroscope/pull/3184/files#diff-ed660caba4be49d0b3854003a14e854719b063ad0141ec736c8e1119a3c7a9a7R30
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added tracefs automount 5bf3ab9#diff-8899fb2a871c6c203d47853b2398f1818fd5fa5817aabd462fd37a4d0554c495R281-R301
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, I currently run alloy using pyroscope.ebpf with only few capabilities (BFP,PERF,PTRACE), and I believe that the mount syscall at least requires SYS_ADMIN, would there be any workaround or it is mandatory to mount this fs ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can mount the fs yourself and the component will not issue any mount syscalls