Skip to content

Latest commit

 

History

History

spring-cloud-azure-starter-monitor

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Azure Monitor OpenTelemetry Distro / Application Insights in Spring Boot native image Java application

This project is an Azure distribution of the OpenTelemetry Spring Boot starter.

It allows you to get telemetry data on Azure with a Spring Boot native image application.

For a Spring Boot application running on a JVM runtime (not with a GraalVM native image), we recommend using the Application Insights Java agent.

Source code | Package (Maven) | API reference documentation | Product Documentation

Getting started

Prerequisites

For more information, please read introduction to Application Insights.

Build update

OpenTelemetry configuration

Import the OpenTelemetry Bills of Materials (BOM) by following the OpenTelemetry documentation.

Add monitoring dependency

Add the Spring Cloud Azure Starter Monitor dependency.

Required native image build configuration

Instruction for Spring Boot native image applications.

Enable OpenTelemetry features

All the features described in the OpenTelemetry Spring Boot starter documentation work with Azure Monitor OpenTelemetry Distro / Application Insights in Spring Boot native image Java application.

You have just to replace the opentelemetry-spring-boot-starter dependency by the spring-cloud-azure-starter-monitor one.

Azure Monitor configuration

Connection String

In order to export telemetry data to Azure Monitor, you will need the connection string to your Application Insights resource. Go to Azure Portal, search for your resource. On the overview page of your resource, you will find the connection string in the top right corner.

You can then configure the connection string in two different ways:

  • With the APPLICATIONINSIGHTS_CONNECTION_STRING environment variable
  • With the applicationinsights.connection.string system property. You can use -Dapplicationinsights.connection.string or add the property to your application.properties file.

Cloud role name

The Application Map uses the cloud role name to identify components on the map.

You can set the cloud role name with the spring.application.name property. You have other options to set the cloud role role: see how to set the service name in the OpenTelemetry documentation.

Build your Spring native application

At this step, you can build your Spring Boot native image application and start it:

mvn -Pnative spring-boot:build-image
docker run -e APPLICATIONINSIGHTS_CONNECTION_STRING="{CONNECTION_STRING}" {image-name} 

where you have to replace {CONNECTION_STRING} and {image-name} by your connection string and the native image name.

Disable the monitoring

You can disable the monitoring by setting the otel.sdk.disabled property or the OTEL_SDK_DISABLED environment variable to true.

Mehr erfahren

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Impressions