GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — #307 Add experimental OTLP profiles export by arnabnandy7 · Pull Request #335 · grafana/pyroscope-java Conversation
|
|
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
lets try to implement this in the PyroscopeExporter
Sorry, something went wrong.
There was an error while loading. Please reload this page.
implemented, you can review @korniltsev-grafanista |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Adds opt-in, experimental support for exporting Java profiles via the OpenTelemetry Profiles signal over OTLP/HTTP, leveraging async-profiler’s native OTLP dump support while preserving the existing JFR + /ingest default path.
Changes:
Format.OTLP and config parsing for PYROSCOPE_FORMAT=otlp, with validation to reject OTLP when not using the ASYNC profiler./v1development/profiles) and tests covering config parsing, validation, and exporter behavior.Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| README.md | Documents experimental OTLP Profiles export configuration and limitations. |
| agent/src/test/java/io/pyroscope/javaagent/impl/PyroscopeExporterTest.java | Adds OTLP export test covering endpoint path and protobuf content-type/body. |
| agent/src/test/java/io/pyroscope/javaagent/config/OtlpConfigTest.java | Adds tests for OTLP format parsing and rejection with JFR profiler type. |
| agent/src/test/java/io/pyroscope/javaagent/AsyncProfilerDelegateCommandTest.java | Adds test ensuring OTLP start command preserves profiler options and omits file=. |
| agent/src/main/java/io/pyroscope/javaagent/impl/PyroscopeExporter.java | Adds OTLP request body handling and OTLP endpoint URL construction. |
| agent/src/main/java/io/pyroscope/javaagent/config/Config.java | Adds otlp parsing and rejects OTLP unless profiler type is ASYNC. |
| agent/src/main/java/io/pyroscope/javaagent/AsyncProfilerDelegate.java | Adds dumpOtlp() support and unifies start command generation for OTLP/JFR. |
| agent/src/main/java/io/pyroscope/http/Format.java | Adds OTLP to supported formats. |
agent/src/main/java/io/pyroscope/http/Format.java:9
JFR ("jfr"),
OTLP ("otlp");
/**
* Profile data format, as expected by Pyroscope's HTTP API.
*/
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
few nits and a copilot complain
please take a look
otherwise lgtm
thanks \m/
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I've tried it running locally, it looks like the data is sent to the pyroscope, but I could not query it back. I've used this configuration did you test it? did it work for you? can we add an integration test to verify the data is queryable back? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks for testing this, and you are right to ask for an end-to-end query check. I had previously verified payload generation and HTTP export, but not queryability through Pyroscope. I reproduced your setup with the pinned Pyroscope 2.1.0 image and added a local draft integration test using this repository's existing Docker/Go harness. The test:
It currently fails. The agent logs successful uploads every five seconds, but no query returned Fib frames during the full three-minute retry window. I also checked label values: only Pyroscope's own self-profile was queryable ( So the current change demonstrates successful OTLP transport, but not usable ingestion into Pyroscope 2.1.0. I have not pushed the failing draft test. I need to resolve the compatibility/encoding issue first, then I will add the integration test as the regression check. Thanks for catching this gap. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
I dug into this further and found the reason Pyroscope accepts the request but does not return the Java profile. The async-profiler version bundled here emits the OpenTelemetry Profiles 1.9 wire format, while Pyroscope 2.1.0 is built against Profiles 1.10. There was a breaking protobuf change between those versions: Sample.values moved from field 2 to field 4. Pyroscope can unmarshal the request, so the HTTP call succeeds, but it sees the samples without values and there is nothing useful to query. There was an upstream attempt to fix this in async-profiler/async-profiler#1736, but that PR was closed on June 1 after the author did not respond to review feedback. The patch was not merged. I think the practical way forward is:
We can also send a new upstream PR with the concrete reproduction and test evidence, but this PR does not need to wait for that if the Grafana fork publishes the compatible binaries. There is one more metadata limitation after that: async-profiler does not currently populate resource attributes, so I do not want to patch protobuf field numbers in the Java exporter because that would be a brittle copy of an experimental schema. Updating the native encoder and keeping the integration test as the compatibility check seems safer. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@korniltsev-grafanista Upstream confirmed that async-profiler 4.5 contains the OTLP Profiles compatibility work and has been verified with Pyroscope 2.1.1. I opened grafana/pyroscope-async-profiler#21 to bring upstream 4.5 into Grafana's fork while preserving its Grafana-specific context and trace ID changes. Once the fork publishes v4.5.0.0, I will update this PR to use it and run the Docker integration test against Pyroscope 2.1.1, including a query assertion for the Fib profile. service.name is still separate upstream work, so the first integration test will isolate the workload without relying on that label. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
i've just updated asprof. lets try with the new version |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Signed commits reportAll 1 commit between |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
ee0d818 to
8782802
Compare
@korniltsev-grafanista 🙌 The async-profiler update fixed it. I updated this branch to v4.5.0.0 and added an integration test against Pyroscope 2.1.1. The test starts the Fib workload with OTLP enabled, queries the profile back, and verifies that the returned stack contains Fib.fib. The detail I initially missed was that the native OTLP profile is stored as Both the new OTLP integration test and the existing legacy integration test pass locally. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Yes. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
sam altman found this:
The Java agent constructs:
agent/src/main/java/io/pyroscope/javaagent/AsyncProfilerDelegate.java lines
103-108if (config.profilingAlloc != null && !config.profilingAlloc.isEmpty()) {
sb.append(",alloc=").append(config.profilingAlloc);
}
if (config.profilingLock != null && !config.profilingLock.isEmpty()) {
sb.append(",lock=").append(config.profilingLock);
}This produces roughly:
start,event=itimer,alloc=512k,lock=10ms,...
In bundled async-profiler v4.5.0.0, Profiler::start() detects multiple event bits
and returns:Only JFR output supports multiple events
Source (https://github.com/grafana/pyroscope-async-profiler/blob/934b6362de9a13e285
4e0b58996bf9311cc58f2f/src/profiler.cpp#L853-L859)That becomes an IllegalStateException, propagates from
AsyncProfilerDelegate.start(), and stops the scheduler. No OTLP payload is
generated or uploaded.
can we update our code to fail early? basically reject running multiple events if it is a OTLP format?
or as an alternative - drop secondary events and issue a log warning , so that it does not fail
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Signed-off-by: Arnab Nandy <[email protected]>
8782802 to
5ae54b4
Compare
I chose this option, please validate. I've tested as well, it's working. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5ae54b4. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| return createStartCommand(config, format, tempJFRFile); | ||
| } | ||
|
|
||
| static String createStartCommand(Config config, Format format, File tempJFRFile) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Low Severity
createStartCommand accepts a nullable tempJFRFile (callers pass null for OTLP), but the new parameter lacks a @Nullable annotation. Agent convention requires @Nullable on new nullable parameters.
Reviewed by Cursor Bugbot for commit 5ae54b4. Configure here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Support for OTLP profiles
There was an error while loading. Please reload this page.