-
Notifications
You must be signed in to change notification settings - Fork 916
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
Enable using JMX Metrics instrumation as a library, not only through javaagent #12308
Comments
hi @adamw!
I think this is what you want.
check out Line 27 in faff2d9
|
@trask Thanks, I do have that, and I'm calling |
In my case, the proper way to solve my problem (exposing runtime JVM metrics) was to use a dedicated library: However, I still think that having a way of using the JMX metrics bridge without the java agent would be beneficial, so I'm keeping this open. |
cc @PeterF778 |
If I remember correctly, JMX Metric Insight uses two different calls for building the configuration (parser) and for starting the collection to make sure that no attempts to report metrics happen before the agent is fully initialized (metric exporter, etc.). I'll have another look to see if this can be made more user friendly. |
I revisited the code. The |
@adamw Hey in case you haven't seen yet, there's been a new effort to consolidate the jmx stuff in contrib with what's in the agent, and the result is the newish Does that help with your specific use case? Thanks! |
Also, feel free to provide feedback on how we could/should reuse the JMX metrics definitions once they are defined in a single location here: #13238 |
This has been automatically marked as stale because it has been marked as needing author feedback and has not had any activity for 7 days. It will be closed automatically if there is no response from the author within 7 additional days from this comment. |
FYI the current approach we are taking is to add the yaml files with PRs similar to #13392 that I opened for JVM metrics. Once this is merged and released we should be able to reuse those definitions as-is with jmx-scraper or in any tool that relies on the jmx-metrics library provided by instrumentation. |
Sorry for being late into the discussion :) I'm currently using opentelemetry-runtime-telemetry-java8 and registering the observers as described in that readme. Would the |
No, the
Doing so allows to provide a single place to store all the yaml files and reuse them, the compromise is that it can be a bit confusing to see a yaml file that is not used in the agent but this is fine as long as there is only one for JVM metrics. Also, another notable difference is that for some metrics we can't get all the recommended metric attributes through JMX, for example: |
Is your feature request related to a problem? Please describe.
I'd like to use the Otel <-> JMX integration as a library, without the need to install a Java Agent, as described currently on: https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/jmx-metrics/javaagent/README.md
I don't think the
javaagent
code is published, I've been only able to find thelibrary
on Maven Central:Describe the solution you'd like
My goal is to include all observability-related setup as code, in the
main
method of the application. I've got OTEL working without problems usingAutoConfiguredOpenTelemetrySdk.initialize().getOpenTelemetrySdk()
, but to get the JMX integration I think I'll have to copy the initialisation code fromJmxMetricInsightInstaller.java
for now.Ideally. I'd be able to do sth like
JmxMetrics.initialise(openTelemetry)
, given an instance ofOpenTelemetry
.Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: