Skip to content
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

The agent doesn’t correctly query Tomcat JMX metrics when using embedded Tomcat with SpringBoot #59

Closed
jasonjkeller opened this issue Sep 16, 2020 · 5 comments
Labels
bug Something isn't working as designed/intended on-roadmap Issue has been added to our product roadmap and will be worked in the coming quarter

Comments

@jasonjkeller
Copy link
Contributor

jasonjkeller commented Sep 16, 2020

The agent doesn’t correctly query the following Tomcat JMX metrics when using embedded Tomcat with SpringBoot:

  • type=DataSource
  • type=ThreadPool
  • type=Manager

We add Tomcat JMX values for the above categories if the server was started via one of the following two methods:

org.apache.catalina.startup.HostConfig.start()
org.apache.catalina.core.StandardServer.startInternal()

It appears that when using embedded Tomcat with Spring Boot StandardServer does get instrumented properly:

Supportability/WeaveInstrumentation/WeaveClass/com.newrelic.instrumentation.tomcat-jmx/org/apache/catalina/core/StandardServer
Supportability/WeaveInstrumentation/WeaveClass/com.newrelic.instrumentation.tomcat-8.5.2/org/apache/catalina/core/StandardServer

By default, embedded Tomcat JMX is disabled by Spring Boot. In application.properties Tomcat mbeans need to be enabled by adding: server.tomcat.mbeanregistry.enabled=true

The problem though is that the Mbean group namespaces are different, standalone Tomcat uses the prefix Catalina for queries whereas embedded Tomcat uses the prefix Tomcat. Our tomcat-jmx instrumentation only queries MBeans with the Catalina prefix thus queries initiated by embedded Tomcat fail due to an incorrect group name.

Standalone Tomcat JMX:
standalone-catalina

Embedded Tomcat JMX
embedded-tomcat

For now, the recommended workaround would be to utilize Custom JMX instrumentation by YAML and create a dashboard to view the metrics.

(migrate to Jira)

@jasonjkeller jasonjkeller added the bug Something isn't working as designed/intended label Sep 16, 2020
@XiXiaPdx XiXiaPdx self-assigned this Oct 12, 2020
@XiXiaPdx XiXiaPdx removed their assignment Dec 16, 2020
@workato-integration
Copy link

@kford-newrelic kford-newrelic added the on-roadmap Issue has been added to our product roadmap and will be worked in the coming quarter label Sep 30, 2022
@workato-integration
Copy link

Jira CommentId: 97307
Commented by bellis:

https://github.com/newrelic/newrelic-java-agent/pull/1039/files

@workato-integration
Copy link

Jira CommentId: 97307
Commented by bellis:

 

[https://github.com//pull/1039]

 

1 similar comment
@workato-integration
Copy link

Jira CommentId: 97307
Commented by bellis:

 

[https://github.com//pull/1039]

 

@workato-integration
Copy link

Work has been completed on this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as designed/intended on-roadmap Issue has been added to our product roadmap and will be worked in the coming quarter
Projects
Archived in project
Development

No branches or pull requests

3 participants