Skip to content
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

Add JFR streaming metrics gatherer #7886

Merged
merged 18 commits into from
Mar 29, 2023

Conversation

roberttoyonaga
Copy link
Contributor

@roberttoyonaga roberttoyonaga commented Feb 23, 2023

Summary of changes:

Usage
Include -Dotel.instrumentation.runtime-telemetry-jfr.enabled=true to enable metrics not already covered by JMX.
Include -Dotel.instrumentation.runtime-telemetry-jfr.enable-all=trueto enable all JFR metrics gathering.

Notes
The diff is quite massive, but almost all of it is a direct copy-paste.

A follow up PR will be made to rename runtime-metrics to runtime-telemetry-jmx

I'm not sure why the test Agent loads in when separate jvm is launched fails with this output. Note, this only happens when JFR is activated in the Java agent by default (I've currently disabled it which means the test is currently passing. See comments below).

@mateuszrzeszutek
Copy link
Member

@roberttoyonaga can you split out the runtime-metrics rename to a separate PR?

@roberttoyonaga
Copy link
Contributor Author

@roberttoyonaga can you split out the runtime-metrics rename to a separate PR?

Yup I can do that

@roberttoyonaga roberttoyonaga changed the title Add JFR streaming metrics gatherer and rename to runtime-telemetry-jfr and runtime-telemetry-jmx Add JFR streaming metrics gatherer Mar 2, 2023
public void afterAgent(AutoConfiguredOpenTelemetrySdk autoConfiguredSdk) {
ConfigProperties config = autoConfiguredSdk.getConfig();

boolean defaultEnabled = config.getBoolean("otel.instrumentation.common.default-enabled", true);
Copy link
Member

Choose a reason for hiding this comment

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

Does this say that jfr instrumentation is enabled by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I thought that might be a good choice because its similar to the JMX gatherer, which is also collecting metrics. And by default we are only collecting metrics not already covered by JMX.

Copy link
Member

Choose a reason for hiding this comment

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

And by default we are only collecting metrics not already covered by JMX.

True.. although the metrics it produces aren't part of the semantic conventions (yet). Wondering if that influences our decision.

Generally, I think they contain useful data, but need just a bit of adjustment to match the metric semantic conventions guidelines. I.e. they are likely to change before being added.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm I see, yeah I think maybe its better to disable them by default. Then once its decided how the semantic conventions can be updated, they can be enabled by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also discussed at the March 2 2023 SIG. Decided that the new metrics should not be enabled by default until the semantic conventions can be updated.

}

otelJava {
minJavaVersionSupported.set(JavaVersion.VERSION_17)
Copy link
Member

Choose a reason for hiding this comment

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

Curious how this works with the agent. Do we publish different versions of the agent, or do we package the jfr stuff up in the java 8 agent and only allow it to be activated if we detect we're running on java 17+?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not 100% clear on this either. I tried building with 17, and running with 11 and things run normally, just without the JFR streaming.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed in the March 2 2023 SIG . Confirmed nothing must be done in order to prevent JDK17 features from breaking things.

@roberttoyonaga roberttoyonaga marked this pull request as ready for review March 3, 2023 20:12
@roberttoyonaga roberttoyonaga requested a review from a team as a code owner March 3, 2023 20:12
@roberttoyonaga roberttoyonaga requested review from jack-berg and removed request for theletterf March 14, 2023 18:48
…/opentelemetry/instrumentation/runtimetelemetryjfr/GenerateDocs.java

Co-authored-by: Mateusz Rzeszutek <[email protected]>
roberttoyonaga and others added 4 commits March 28, 2023 09:04
…/opentelemetry/instrumentation/runtimetelemetryjfr/JfrTelemetryBuilder.java

Co-authored-by: Mateusz Rzeszutek <[email protected]>
…/opentelemetry/instrumentation/runtimetelemetryjfr/internal/DurationUtil.java

Co-authored-by: Mateusz Rzeszutek <[email protected]>
…aga/opentelemetry-java-instrumentation into jfr-runtime-metrics-gatherer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants