Skip to content

Conversation

@SylvainJuge
Copy link
Contributor

@SylvainJuge SylvainJuge commented Dec 21, 2023

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
Copy link
Member

trask commented Dec 21, 2023

cc @PeterF778

@PeterF778
Copy link
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