Automatic Instrumentation of Applications in Microsoft Azure App Service for LogicMonitor
Last updated on 27 March, 2023If you use Microsoft Azure App Service to manage your applications, you can configure your environment to collect the trace data of those applications on Azure App Service.
To ensure LogicMonitor receives trace data from applications on Azure App Service, you must do the following:
- Instrument the application in Azure App Service.
- Configure the application to emit trace data to the OpenTelemetry Collector.
Recommendation: Deploy an OpenTelemetry Collector to the Azure Container Instance before instrumenting an application. Instrumenting an application requires the endpoint of the OpenTelemetry Collector. For more information, see Configurations for OpenTelemetry Collector Deployment in Microsoft Azure Container Instance.
Requirements to Automatically Instrument an Application in Microsoft Azure App Service
To automatically instrument an application in Azure App Service, you must do the following:
- Create an Azure storage account
For more information, see Microsoft’s Create a storage account documentation. - Create a container in your Azure portal
For more information, see Microsoft’s Quickstart: Upload, download, and lists blobs with the Azure portal documentation.
In addition, you must download the Java agent JAR file from OpenTelemetry to upload the file to your container. For more information about the Java agent JAR file, see OpenTelemetry’s Automatic Instrumentation documentation.
Instrumenting your Application in Azure App Service
Note: The following uses Java as an example sample application. Reference the applicable documentation from OpenTelemetry for your application’s language.
- Use Mount storage to Linux container (or the applicable documentation for your container’s platform) from Microsoft’s Mount Azure Storage as a local share in App Service documentation to configure the settings.
- Select your storage account and container.
- Enter
/java-jar
for the mount path and save the configuration.
The application restarts with the Java agent JAR file, automatically instrumenting the application.
Configuring the Application to Emit Trace Data
To ensure LogicMonitor can receive trace data from applications on Azure App Service, you must modify the application’s configuration file to include a variable that tells the application to export traces to the OpenTelemetry Collector deployed in the Azure Container Instance.
Use Microsoft’s Quickstart: Create a Java app on Azure App Service documentation (or the applicable documentation for your application’s language) to create and deploy your application, and add the following <appSetting>
property to the configuration in your pom.xml
prior to deploying the application:
<appSettings>
<property>
<name>JAVA_OPTS</name>
<value>-javaagent:/java-jar/opentelemetry-javaagent-all.jar -Dotel.traces.exporter=otlp -Dotel.resource.attributes=host.name=HOST_NAME,service.name=SERVICE_NAME,service.namespace=SERVICE_NAMESPACE,resource.type=host -Dotel.exporter.otlp.insecure=true -Dotel.exporter.otlp.endpoint=CONTAINER_INSTANCE_PRIVATE_IP:4371 -Dotel.metrics.exporter=none</value>
</property>
</appSettings>
Recommendation: Keep CONTAINER_INSTANCE_PRIVATE_IP
as your Azure container instance IP.
Recommendation: To ensure your application emits trace data securely to LogicMonitor, use the private virtual network integration you created for deploying the OpenTelemetry Collector in your Azure portal to allow private connectivity from an Azure Container Instance to your LogicMonitor portal. For more information, see Microsoft’s Enable virtual network integration in Azure App Service documentation to add your virtual network to the configuration.