feat: Add support for JFR contextual information#2739
Conversation
|
|
There was a problem hiding this comment.
Pull request overview
This PR adds support for JFR contextual information by implementing the @Contextual meta-annotation for OpenTelemetry JFR events. This allows lower-level JVM/JDK events (like lock contention) to inherit trace and span context information when using tools like jfr print in JDK 25+. The implementation annotates the operationName field in SpanEvent and the traceId field in ScopeEvent (as a top-level event) to avoid information repetition.
Changes:
- Creates a
@Contextualmeta-annotation that mimics JDK 25's annotation without requiring JDK 25 compilation - Annotates
operationNamein SpanEvent andtraceIdin ScopeEvent with@Contextual - Extends unit tests to verify the presence of
@Contextualannotations on these fields - Updates README documentation to note which fields have the
@Contextualannotation
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| jfr-events/src/main/java/io/opentelemetry/contrib/jfrevent/Contextual.java | New meta-annotation to support @Contextual for JFR contextual information |
| jfr-events/src/main/java/io/opentelemetry/contrib/jfrevent/SpanEvent.java | Annotates operationName field with @Contextual |
| jfr-events/src/main/java/io/opentelemetry/contrib/jfrevent/ScopeEvent.java | Annotates traceId field with @Contextual |
| jfr-events/src/test/java/io/opentelemetry/contrib/jfrevent/JfrSpanProcessorTest.java | Adds tests to verify @Contextual annotations are present on fields |
| jfr-events/README.md | Updates documentation to indicate which fields are @contextual; contains an incorrect field reference |
d152a4f to
f883cde
Compare
|
@sfriberg any chance you can give this a review? |
|
@marschall please have a look at the unresolved comment and resolve the merge conflict. Thanks! |
Just updated it. |
Description:
Feature addition
Annotate the operationName and traceID event fields with contextual so it shows up when using
jfr print.Existing Issue(s):
#2057
Testing:
Existing unit tests extended.
Documentation:
Attribute documentation in readme updated.
Outstanding items:
See discussion in #2057