alloy icon indicating copy to clipboard operation
alloy copied to clipboard

pyroscope.ebpf: otel profiler implementation

Open korniltsev opened this issue 8 months ago • 6 comments

PR Description

This PR changes the implementation of pyroscope.ebpf compoenent from grafana/pyroscope/ebpf to opentelemetry-ebpf-profiler - a fork of opentelemetry-ebpf-profiler. The notable changes of the fork: native frame symbolization, dynamic profiling policy, target discovery labels.

The fork uses a rust library for symbol extraction. See https://github.com/open-telemetry/opentelemetry-ebpf-profiler/tree/main/rust-crates.

In this PR I put all pyroscope.ebpf code behind a pyroscope_ebpf go tag, so that it is not compiled by default and does not require to compile and link libsymblib_capi.a. I've added some link directives that links to target/x86_64-unknown-linux-musl/release/libsymblib_capi.a automatically so that no linker flags are needed from the user. This autolinking can be disabled with another go tag flag pyroscope_ebpf_no_link. Then you can link the lib any other way, for example CGO_LDFLAGS=./libsymblib_capi.a

Some component arguments became no-op as there are no corresponding knobs in the new implementations. These args a deprecated

// deprecated
	PidCacheSize int `alloy:"pid_cache_size,attr,optional"`
	// deprecated
	BuildIDCacheSize int `alloy:"build_id_cache_size,attr,optional"`
	// deprecated
	SameFileCacheSize int `alloy:"same_file_cache_size,attr,optional"`
	// deprecated
	CacheRounds int `alloy:"cache_rounds,attr,optional"`
	// deprecated
	GoTableFallback bool `alloy:"go_table_fallback,attr,optional"`
	// deprecated
	SymbolsMapSize int `alloy:"symbols_map_size,attr,optional"`

Which issue(s) this PR fixes

Notes to the Reviewer

PR Checklist

  • [x] CHANGELOG.md updated
  • [x] Documentation added
  • [x] Tests updated
  • [ ] Config converters updated

korniltsev avatar Mar 06 '25 12:03 korniltsev

:computer: Deploy preview deleted.

github-actions[bot] avatar Mar 10 '25 05:03 github-actions[bot]

Found some python issues, currently working on them now https://github.com/open-telemetry/opentelemetry-ebpf-profiler/pull/414 https://github.com/open-telemetry/opentelemetry-ebpf-profiler/pull/412

korniltsev avatar Mar 25 '25 09:03 korniltsev

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Apr 02 '25 19:04 CLAassistant

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Apr 02 '25 19:04 CLAassistant

Hello guys, thanks for the good work! I'm really looking forward for the implementation of otel ebpf profiler Alloy, do we have an estimate on when this could be released? thanks !

luweglarz avatar May 16 '25 09:05 luweglarz

We found multiple bugs in python. We will merge the PR when we fix bugs and can dogfood python workloads and grafana labs.

korniltsev avatar May 19 '25 19:05 korniltsev

I am more or less happy with the way it runs. I do not expect much changes both in alloy and profiler. The CI is red. I need to update otel to 128 I started with https://github.com/grafana/beyla/pull/2052 Will continue with the alloy on Monday

korniltsev avatar Jun 13 '25 12:06 korniltsev