11.2.2. Distributed Tracing in Azure

This chapter describes how to perform distributed tracing on Azure. How to perform distributed tracing on Azure

In Azure, distributed tracing is done using Azure Application Insights.

A mechanism for enabling distributed tracing from Java applications is provided by using a Java agent (Java 3.0 agent).


The Java 3.0 agent loads a large number of jar files during the initialization process. This may cause frequent GC during the initialization process of the Java 3.0 agent.

Therefore, note that the performance may temporarily deteriorate due to GC for a while after the application is launched.

Also, under heavy load, the overhead caused by the processing of the Java 3.0 agent may affect the performance. Therefore, you should confirm the performance in the performance test with the Java 3.0 agent as in production.

The following is an example of using the archetype for containers.

First, download the agent from the official website of Azure. Then, create an arbitrary directory under src/main/jib and store the agent.

Next, place applicationinsights.json in the directory where you have just stored the agent. The connectionString is a connection string containing the instrumentation key that will be issued after the Azure Application Insights resource is created. For other configuration options, see the Guide.

  • applicationinsights.json
  "connectionString": "InstrumentationKey=XXXXX"

Finally, add the environment variable CATALINA_OPTS to jib-maven-plugin in pom.xml. (In the example, we specify applicationinsights-agent-3.0.2.jar, which is located directly under the applicationInsights directory.

  • pom.xml
<! -- Docker containerization -->

Now you can use Azure Application Insights for distributed tracing by building with Jib.

For detailed configuration instructions, see the Azure documentation.