Skip to content

feat: Add support for JFR contextual information#2739

Merged
jaydeluca merged 1 commit into
open-telemetry:mainfrom
marschall:jfr-contextual
May 7, 2026
Merged

feat: Add support for JFR contextual information#2739
jaydeluca merged 1 commit into
open-telemetry:mainfrom
marschall:jfr-contextual

Conversation

@marschall

Copy link
Copy Markdown
Contributor

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

To avoid repetition in the presentation, it's probably best to annotate traceId only in a top-level event, such as the ScopeEvent or perhaps a new event that is even higher-level. SpanID is likely not that interesting either. If too much is annotated with @contextual, it will be hard for humans to parse.

Copilot AI review requested due to automatic review settings April 4, 2026 13:35
@marschall
marschall requested a review from a team as a code owner April 4, 2026 13:35
@linux-foundation-easycla

linux-foundation-easycla Bot commented Apr 4, 2026

Copy link
Copy Markdown

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: marschall / name: Philippe Marschall (f883cde)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 @Contextual meta-annotation that mimics JDK 25's annotation without requiring JDK 25 compilation
  • Annotates operationName in SpanEvent and traceId in ScopeEvent with @Contextual
  • Extends unit tests to verify the presence of @Contextual annotations on these fields
  • Updates README documentation to note which fields have the @Contextual annotation

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

Comment thread jfr-events/README.md Outdated
Comment thread jfr-events/src/main/java/io/opentelemetry/contrib/jfrevent/Contextual.java Outdated
@breedx-splk

Copy link
Copy Markdown
Contributor

@sfriberg any chance you can give this a review?

@jaydeluca jaydeluca mentioned this pull request May 5, 2026
@breedx-splk

Copy link
Copy Markdown
Contributor

@marschall please have a look at the unresolved comment and resolve the merge conflict. Thanks!

@marschall

Copy link
Copy Markdown
Contributor Author

@marschall please have a look at the unresolved comment and resolve the merge conflict. Thanks!

Just updated it.

@jaydeluca
jaydeluca added this pull request to the merge queue May 7, 2026
Merged via the queue into open-telemetry:main with commit aa2dbfb May 7, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants