Tomcat JMX metrics #10281
Unanswered
SylvainJuge
asked this question in
Q&A
Tomcat JMX metrics
#10281
Replies: 1 comment 4 replies
-
cc @PeterF778 For the first option, are you thinking to extend the jmx metrics yaml syntax, or replace the current yaml-based tomcat metrics with a programmatic implementation? The second option doesn't sound that bad to me. We are just bridging the JMX metrics that Tomcat produces.
Here's some related discussion: open-telemetry/semantic-conventions#269 |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We can capture Tomcat metrics thanks to the JMX Insights (doc) feature.
While working as expected, I noticed something quite surprising when trying to use the metrics, in particular
http.server.tomcat.threads
described here.There are multiple related aspects, so I will try to describe this in a structured manner.
Small bug ?
The
http.server.tomcat.threads
metric is captured from two MBean attributes ofCatalina:type=ThreadPool,name=*
:currentThreadCount
andcurrentThreadsBusy
(yaml definition).The mapping of the
state
attribute is the followingcurrentThreadsBusy
is mapped tostate = "busy"
.currentThreadCount
is mapped tostate = "idle"
, but it actually represents the total number of threads so this is definitely not the number of "idle" threads, so here maybe a better attribute value would be something like "total", but that does not fit the semconv recommendations.Compliance with semantic convention metrics definitions
The general guidelines for metrics clearly state the following: "aggregations over all the attributes of a given metric SHOULD be meaningful", so here the metric does not fit because removing the
state
attribute and adding the values would result in double-counting the threads that are busy.Also, using the "total" in metric name as I suggested is also not recommended for counters.
I see two possible approaches to fixing this:
http.server.tomcat.threads
metric withstate = "idle"
for idle threads andstate = "busy"
for busy threads, aggregating by removing thestate
attribute would provide the total number of threads.http.server.tomcat.threads.count
for the total number of threadshttp.server.tomcat.threads.busy.count
for the busy threadsI think that the first approach would be better, even if more complex to implement as this kind of issues are likely to happen with many other JMX metrics.
Using the second option is simpler, but it's a compromise to work around the way that JMX metrics are exposed.
Should we define those in semantic conventions ?
I think those metric definitions would be better if they were part of the semantic conventions like the now stabilized JVM metrics. I understand there is a non-trivial effort required for this, but from the perspective of the consumer of those metrics the fact that they are captured from JMX and relate to Java and the JVM is only an implementation detail.
Defining those in the semantic conventions will also require that we address the points above.
Beta Was this translation helpful? Give feedback.
All reactions