Observability with Azure Monitor Application Insights

Official Content
This documentation is valid for:

GeneXus enables monitoring and analyzing the performance of applications using the features and capabilities of Azure Application Insights through instrumentation for:

  • .NET Web applications running elsewhere.
  • Java Web containerized applications (Deploy to Docker). As auto-instrumentation in java, consists only on attaching a Java agent JAR to any Java 8+ application. It can be done at production using infrastructure configuration.

Assuming you have already defined the Application Insights and have access to the Connection String, as the figure shows, you can follow the steps below:


  1. Set the Observability Provider property.
  2. Deploy your application.
  3. Configure the Environment Variables.  
  4. Analyze the data.  

Set the Observability Provider property

Set the Observability Provider property to "Azure Monitor Application Insights" value. 

Deploy your application

In Java, use the deployment engine tool to deploy your app to Docker (builds a Docker image).

Configure the Environment Variables

Set an environment variable pointing to the Connection String.

The environment variable should be:


For the case of containerized applications, you set the environment variable when you run the Docker image.

If the environment variable is not set, the connection string will be calculated using a default Credential authentication flow based on the order explained here. This applies for applications that will be deployed to Azure.


docker run -p 8081:8080 -e APPLICATIONINSIGHTS_CONNECTION_STRING="InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com/;LiveEndpoint=https://westus.livediagnostics.monitor.azure.com/" miImageId

Note: You may need to add other environment variables, such as APPLICATIONINSIGHTS_ROLE_NAME.

The app which is going to be instrumented, and its components don't have to be hosted in Azure. The instrumentation monitors your app and directs the telemetry data to an Application Insights resource using a unique token. 

Getting Opentelemetry logs in Application Insights

For the .NET generator, for now, you need to manually add an appender to the log.config file (log4net configuration file) in order to have the log messages in Application Insights (user log messages as well as the .NET standard classes messages).
You should add an appender like the following:

 <appender name="aiAppender" type="Microsoft.ApplicationInsights.Log4NetAppender.ApplicationInsightsAppender, Microsoft.ApplicationInsights.Log4NetAppender">
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%message%newline" />

And reference it in any logger, as shown below:

        <level value="ALL"/>
        <appender-ref ref="aiAppender"/>

Analyze the data

 After running the application, follow the steps in the Azure documentation to analyze the data obtained. See Distributed tracing telemetry correlation.




Generator: Java.NET


This functionality is available since GeneXus 18 Upgrade 4.

See Also

Configuration options: Azure Monitor Application Insights for Java