-
Notifications
You must be signed in to change notification settings - Fork 129
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
JMX: Tomcat sessions is always exported as 0 #1360
Comments
Looked into the code a bit and I think I figured it out. It's because the MBean for the tomcat manager opentelemetry-java-contrib/jmx-metrics/src/main/resources/target-systems/tomcat.groovy Lines 18 to 19 in b7345dc
and many others are being defined as a single bean Lines 80 to 83 in b7345dc
when in reality, the object name includes a wildcard and after performing a query against the MBean server,
What ends up happening is that the gatherer will fetch all the MBeans that match the pattern and then because it thinks it's a single MBean, it only keeps the first one. Lines 93 to 99 in b7345dc
So, the metrics don't represent an aggregated value of all the beans that match the pattern. It's just the first one, which happens to be 0. |
It looks like this is a simple case of misconfiguration. The JVM metrics are defined correctly using opentelemetry-java-contrib/jmx-metrics/src/main/resources/target-systems/jvm.groovy Line 21 in b7345dc
The Tomcat metrics just need to be updated to use |
Not quite so simple. The gatherer needs to be updated to support aggregating metrics with the same attributes. After changing the metrics to
|
Just to circle back on this -- there's currently an effort underway to deprecate/remove the In the first pass, it does look like we are continuing to support the opt-in aggregation flag (as implemented in #1366), but long term we want to report values from all the MBeans with some mbean name as an attribute/dimension so that it can be aggregated or ignored as appropriate in backends. |
Hi, With the In the current PR proposal #1485 (which I hope will be merged soon), the metrics for opentelemetry-java-contrib/jmx-scraper/src/main/resources/tomcat.yaml Lines 12 to 13 in 3362166
In the short, term once #1485 is merged and released you should be able to test this |
Yes, I'm happy with where this has landed. The other module has the opt-in aggregation flag, and the (new) jmx scraper has the more correct dimension. Any reason to leave this open then? |
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 if no further activity occurs within 7 days of this comment. |
Component(s)
jmx-metrics
What happened?
Description
When using tomcat as the target system for jmx-metrics,
tomcat.sessions
is always emitted as 0 despite the MXBeans showing a non-zero value for theactiveSessions
attribute.Steps to Reproduce
activeSessions
is non-zero.The above is the output from jmxterm to query the MXBeans. As can be seen, the value matches the expectation.
tomcat.sessions
coming from jmx-metrics. For example, setup an OTel collector pipeline with a JMX receiver and debug exporter.Expected Result
I expect the value of
tomcat.sessions
as per the definition here to also be non-zero.Actual Result
The value of
tomcat.sessions
is always 0.Component version
v1.35.0
Log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: