-
Notifications
You must be signed in to change notification settings - Fork 881
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
Rename runtime-metrics
to runtime-telemetry-jmx
#8165
Conversation
hey @roberttoyonaga! we discussed the naming of these modules in Java SIG meeting this week I had a couple of concerns with the current proposal (
A couiple of alternatives were discussed: Alternative A
this mirrors other instrumentations which apply to different versions @mateuszrzeszutek one thought I had since we discussed is that it seems confusing that Java 17 library users would want to use both Alternative Bhave a single @laurit @mateuszrzeszutek is the only argument against mrjar the added complexity? we have one mrjar example module: opentelemetry-java-instrumentation/instrumentation/resources/library/build.gradle.kts Line 5 in c59c370
and while that's not being used by the javaagent, it does look like AgentClassLoader supports mrjars: Line 56 in c59c370
so maybe added complexity is not too bad? |
AFAIR we use that in the resource providers module.
I suspect most of the complexity will be in implementing the |
Could an Alternative C be: Use the same structure as in "Alternative A" but have the entry point in I'm not that knowledgeable about multi release jars. But would the following make sense: For the java agent, I think we could have a Java 8 implementation that only registers the JMX handlers, and a Java 17 version which registers JFR as well. With respect to the libraries, I think it could be good to introduce a single entry point for JMX (similar to JFR) that can register all the JMX handlers (since they are all required anyway). Once that's in place, we can have an over-arching |
One potential issue with mrjar is that class loader needs to support mrjar for it to work. If user includes the metrics library in his war and deploys it into his favourite app server then this app server has to support mrjar to get access to the jdk17 features. As mrjars have been around for a while it is quite possible that support for them has been implemented everywhere where it matters. |
ah, yes, like opt-ing in to some higher-cardinality metrics, e.g. open-telemetry/opentelemetry-specification#3352 (comment)
this idea makes good sense to me In this case I don't think we need mrjar, and the javaagent instrumentation can be written so that it also only applies to java8 or java17 (but not both) |
@roberttoyonaga sorry for the delay, will merge this right after the 1.26.0 release tomorrow |
@@ -3,7 +3,7 @@ | |||
* SPDX-License-Identifier: Apache-2.0 | |||
*/ | |||
|
|||
package io.opentelemetry.instrumentation.runtimemetrics; | |||
package io.opentelemetry.instrumentation.runtimemetricsjava8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about renaming the package to ...runtimemetrics.java8
? (or ..runtimemetrics.j8
)
I think that the java8
/java17
implementations are somewhat similar to our usual v1_2
package name suffixes; this is the same feature/instrumentation, but for different runtime versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I've renamed to ...runtimemetrics.java8
and ...runtimemetrics.java17
.setDescription("The number of buffers in the pool") | ||
.setUnit("{buffers}") | ||
.buildWithCallback(callback(bufferBeans, BufferPoolMXBean::getCount)); | ||
public static void closeObservers() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of keeping a global stateful list of observers, WDYT about making the registerObservers(OpenTelemetry)
function return a Closeable
? The users can decide how to handle these themselves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good idea. I have applied your suggestion.
|
||
private static final String INSTRUMENTATION_NAME = "io.opentelemetry.runtime-metrics"; | ||
private static final String INSTRUMENTATION_NAME = | ||
"io.opentelemetry.instrumentation.runtime-metrics"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We usually name our instrumentations io.opentelemetry.<name-version>
"io.opentelemetry.instrumentation.runtime-metrics"; | |
"io.opentelemetry.runtime-metrics-java8"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
...c/main/java/io/opentelemetry/instrumentation/runtimemetricsjava17/RuntimeMetricsBuilder.java
Outdated
Show resolved
Hide resolved
...ary/src/main/java/io/opentelemetry/instrumentation/runtimemetricsjava17/HandlerRegistry.java
Outdated
Show resolved
Hide resolved
...pentelemetry/instrumentation/javaagent/runtimemetricsjava8/Java8RuntimeMetricsInstaller.java
Outdated
Show resolved
Hide resolved
if (config.getBoolean("otel.instrumentation.runtime-metrics-java17.enable-all", false)) { | ||
runtimeMetrics = RuntimeMetrics.builder(openTelemetry).enableAllFeatures().build(); | ||
} else if (config.getBoolean("otel.instrumentation.runtime-metrics-java17.enabled", false)) { | ||
runtimeMetrics = RuntimeMetrics.create(openTelemetry); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should enable both JMX+JFR default metrics if otel.instrumentation.runtime-metrics.enabled
is true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yeah we talked a bit about this here. It was decided that we'd wait for the semantic conventions to be updated first in-case the JFR metrics end up changing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I see.
At the very least, let's add a condition checking otel.instrumentation.runtime-metrics.enabled
somewhere in this method -- the current version of that is impossible to turn off on java 17+
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's a good point. I'll add the same check that's done in Java8RuntimeMetricsInstaller
before enabling the JMX gathered metrics.
Thanks @trask ! Actually, can you hold off on merging for another day? I'm going to try implementing Mateusz's new suggestions. |
…nstrumentation into jmx-rename
ok @trask I'm done with the updates! |
instrumentation/runtime-metrics/runtime-metrics-java17/library/README.md
Outdated
Show resolved
Hide resolved
instrumentation/runtime-metrics/runtime-metrics-java17/library/README.md
Outdated
Show resolved
Hide resolved
instrumentation/runtime-metrics/runtime-metrics-java17/library/build.gradle.kts
Outdated
Show resolved
Hide resolved
...ary/src/main/java/io/opentelemetry/instrumentation/runtimemetrics/java17/RuntimeMetrics.java
Show resolved
Hide resolved
@@ -12,10 +12,9 @@ | |||
import java.util.List; | |||
import javax.annotation.Nullable; | |||
|
|||
class JmxRuntimeMetricsUtil { | |||
public class JmxRuntimeMetricsUtil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move it to an .internal
package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I've moved it to io.opentelemetry.instrumentation.runtimemetrics.java8.internal
now
@dependabot update |
@opentelemetrybot update |
…java-instrumentation into jmx-rename
thx @roberttoyonaga! |
Summary of Changes
Rename the JMX metrics gatherer to
runtime-telemetry-jmx
to be consistent with its JFR counterpart. This change was also talked about a bit here: open-telemetry/opentelemetry-java-contrib#749 (comment)This is a follow up to: #7886
Edit after discussion below
RuntimeMetrics
sets up the metric gatherers from both JMX and JFR implementations.io.opentelemetry.instrumentation.runtime-metrics