Skip to content

JMX metrics for Tomcat with 'Tomcat' JMX domain#10115

Merged
trask merged 1 commit into
open-telemetry:mainfrom
SylvainJuge:jmx-tomcat
Jan 2, 2024
Merged

JMX metrics for Tomcat with 'Tomcat' JMX domain#10115
trask merged 1 commit into
open-telemetry:mainfrom
SylvainJuge:jmx-tomcat

Conversation

@SylvainJuge

@SylvainJuge SylvainJuge commented Dec 21, 2023

Copy link
Copy Markdown
Contributor

When using the JMX Insights feature with a spring-boot application, I noticed that the JMX metrics were not captured when setting OTEL_JMX_TARGET_SYSTEM=tomcat.

The problem is that the JMX MBeans are registered with Tomcat domain instead of Catalina, and thus the rules do not match.

With standalone tomcat servers (tested latest 8.5, 9.0.x and 10.x), the JMX domain is always Catalina. I am not an expert in Tomcat internals but this comes from the implementation of org.apache.catalina.util.LifecycleMBeanBase#getDomain that returns any sub-class implementation of org.apache.catalina.util.LifecycleMBeanBase#getDomainInternal and falls back to Catalina.

Searching for the Tomcat: string in the Tomcat codebase seems to indicate that this is quite a common value, for example here in tests.

While we could use a wildcard in the rules for the JMX domain, for example *:type=GlobalRequestProcessor,name=* in place of Catalina:type=GlobalRequestProcessor,name=*, that might also introduce false-positives if other application servers also have similar named MBeans, thus duplication sounds the best compromize here.

@SylvainJuge
SylvainJuge requested a review from a team December 21, 2023 15:55
@trask

trask commented Dec 21, 2023

Copy link
Copy Markdown
Member

cc @PeterF778

@PeterF778

Copy link
Copy Markdown
Contributor

Looks pretty good to me ...

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.

4 participants