The OpenTelemetry Collector provides an integration with Apache Tomcat to ingest metrics. When configured to use the JMX/Tomcat integration, the Collector fetches metrics from a target MBean server using built-in profiles for Tomcat. From there the metrics are processed and exported to Cloud Observability.
To complete the integration, you will:
opentelemetry-jmx-metrics.jar
file.Configure a JMX remote connection for the Collector receiver to connect to the executing Java Virtual Machine.
This example shows JMX configuration (without authentication) by setting the CATALINA_OPTS
environment variable:
1
2
3
4
export CATALINA_OPTS=-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=$PORT_NUMBER \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false
For more details regarding configuring the Tomcat remote connection, see the official Tomcat documentation.
Add JMX/Tomcat as a receiver and set the following:
jar_path
: The path to the OpenTelemetry JMX metrics jar file.endpoint
: The endpoint of the host:port for the running application. This should be the same port used in the JMX configuration, above.target_system
: The metrics to collect. Values can this integration are jvm
and tomcat
.1
2
3
4
5
6
7
receivers:
jmx/tomcat:
# Default is /opt/opentelemetry-java-contrib-jmx-metrics.jar
jar_path: /opt/opentelemetry-jmx-metrics.jar
endpoint: tomcat:9090 # Required.
target_system: jvm,tomcat # Required.
The OpenTelemetry repo’s readme provides additional details about JMX configuration.
Once the Tomcat receiver is configured, enable it by adding it to one or more pipelines as described in the Collector configuration documentation.
You can validate that metrics are reporting to Cloud Observability on the Metrics details page in Settings.
In Cloud Observability, click Settings > Metric details.
Search for Tomcat metric names.
If needed, click on the metric to edit the description and how the units are displayed in Cloud Observability.
You can create a pre-built dashboard for this integration from the Dashboard list view. Or use the Cloud Observability Terraform Provider to create a dashboard.
For a more complete example that’s ready to run, see the Tomcat integration in Cloud Observability OpenTelemetry Examples.
Updated Dec 1, 2022