Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In the following sections, learn how to get Java autoinstrumentation for specific technical environments.
For more information, see Application monitoring for Azure App Service and Java.
For more information, see Monitoring Azure Functions with Azure Monitor Application Insights.
For more information, see Use Application Insights Java In-Process Agent in Azure Spring Apps.
Note
With Spring Boot Native Image applications, use the Azure Monitor OpenTelemetry Distro / Application Insights in Spring Boot native image Java application project instead of the Application Insights Java agent.
If you're using the exec form, add the parameter -javaagent:"path/to/applicationinsights-agent-3.7.1.jar"
to the parameter list somewhere before the "-jar"
parameter, for example:
ENTRYPOINT ["java", "-javaagent:path/to/applicationinsights-agent-3.7.1.jar", "-jar", "<myapp.jar>"]
If you're using the shell form, add the Java Virtual Machine (JVM) arg -javaagent:"path/to/applicationinsights-agent-3.7.1.jar"
somewhere before -jar
, for example:
ENTRYPOINT java -javaagent:"path/to/applicationinsights-agent-3.7.1.jar" -jar <myapp.jar>
A Dockerfile example:
FROM ...
COPY target/*.jar app.jar
COPY agent/applicationinsights-agent-3.7.1.jar applicationinsights-agent-3.7.1.jar
COPY agent/applicationinsights.json applicationinsights.json
ENV APPLICATIONINSIGHTS_CONNECTION_STRING="CONNECTION-STRING"
ENTRYPOINT["java", "-javaagent:applicationinsights-agent-3.7.1.jar", "-jar", "app.jar"]
In this example, you copy the applicationinsights-agent-3.7.1.jar
and applicationinsights.json
files from an agent
folder (you can choose any folder of your machine). These two files have to be in the same folder in the Docker container.
If you're using a partner container image that you can't modify, mount the Application Insights Java agent jar into the container from outside. Set the environment variable for the container
JAVA_TOOL_OPTIONS=-javaagent:/path/to/applicationinsights-agent.jar
.
For more information, see Using Azure Monitor Application Insights with Spring Boot.
For information on setting up the Application Insights Java agent, see Enabling Azure Monitor OpenTelemetry for Java.
See the Application server configuration
in the OpenTelemetry Java agent documentation for tips on how to configure the -javaagent
for various Java Application Servers.
In all of the examples, you will use -javaagent:/path/to/applicationinsights-agent.jar
instead of -javaagent:/path/to/opentelemetry-javaagent.jar
.