-
Notifications
You must be signed in to change notification settings - Fork 150
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
NEWRELIC-3834 add embedded tomcat jmx instrumentation #1039
Conversation
d658dd1
to
fe4d8ca
Compare
|
newrelic-agent/src/main/java/com/newrelic/agent/jmx/values/EmbeddedTomcatJmxValues.java
Outdated
Show resolved
Hide resolved
b6d9fe4
to
48ec53c
Compare
Tested locally with Spring Boot and embedded Tomcat.
Visually confirmed that the correct charts on JVMs page light up. |
48ec53c
to
6215956
Compare
instrumentation/tomcat-jmx/src/main/java/com/nr/agent/instrumentation/tomcat/TomcatUtils.java
Outdated
Show resolved
Hide resolved
6215956
to
019360f
Compare
//found | ||
try { | ||
if (server.queryNames(new ObjectName("Tomcat:type=Server"), null).size() == 1) { | ||
AgentBridge.jmxApi.addJmxMBeanGroup(JMX_EMBEDDED_PREFIX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Embedded tomcat will have
Tomcat:type=Server
Non-embedded will have:
Catalina:type=Server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
update copyright different name for datasource mbean reorganize tomcat jmx fix tomcat utils check for embedded signal clarify comment for non embedded tc log different paths by name also check datasource b4 adding jmx clarify comment
bb2be1d
to
e1effa1
Compare
Add instrumentation to cover embedded tomcat.
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:
It appears that when using embedded Tomcat with Spring Boot StandardServer does get instrumented properly:
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:
Embedded Tomcat JMX
For now, the recommended workaround would be to utilize Custom JMX instrumentation by YAML and create a dashboard to view the metrics.
Overview
Describe the changes present in the pull request
Related Github Issue
Include a link to the related GitHub issue, if applicable
Testing
run local tests against embedded tomcat to confirm metrics are collected
Checks