Java APM - Setup & Installation Docs | Middleware
Traces | Metrics | App Logs | Custom Logs | Profiling |
---|---|---|---|---|
✅ | ✅ | ✅ | ✅ | ✅ |
This guide walks you through setting up Application Performance Monitoring (APM) on a Java application. These instructions can also be found on the Installation page in your Middleware Account. View example code here.
Infra Agent
Infrastructure Agent (Infra Agent). To install the Infra Agent, see our Installation Guide.
Java Version
Java version 8
or above. Check your Java version with the following command:
Download the latest Middleware instrumentation JAR file from the Github Release Page.
Applications running in a container require an additional environment variable. If your application is not running in a container, move to Step 3.
Add the following environment variable to your application:
DOCKER_BRIDGE_GATEWAY_ADDRESS
is the IP address of the gateway between the Docker host and bridge network. This is 172.17.0.1
by default.
Learn more about Docker bridge networking here Run the following command to find the mw-service
in Kubernetes:
Run the following command to find the mw-service
in Kubernetes:
Add the following environment variable to your application deployment YAML file:
Distributed tracing will be automatically enabled upon completing Step 4: Run Application.
Metrics collection will be automatically enabled upon completing Step 4: Run Application.
Application Logs will be automatically enabled upon completing Step 4: Run Application.
To add custom logs, add this dependency in the pom.xml
file:
Run the following command to download the above dependencies:
Import the logger package:
Then utilize the following functions based on desired log severity levels.
Application Profiling is automatically enabled upon completing Step 4: Run Application.
Use the Logger.recordError(e) method to record a stack trace when an error occurs. See an example of this method below.
Run your application with the command given below.
Continuous profiling captures real-time performance insights from your application to enable rapid identification of resource allocation, bottlenecks, and more. Navigate to the Continuous Profiling section to learn more about using Continuous Profiling with the Java APM.