Walkthrough: Enabling Application Map for Application Insights for xConnect

Abstract

Shows how you enable and configure the Application Insights' Application Map feature for Sitecore XConnect roles and services.

You use the Application Map (part of Azure Application Insights) to get a visual representation of the dependency relationship of components of your application. Each node in the map represents an application component (application node) or its dependency (dependency node). Components are independently deployable parts of a distributed application. The Microsoft documentation for Azure has more information. This visual representation helps you spot performance bottlenecks or failure hotspots across all components of your distributed application.

The Application Map of the Application Insights service is not enabled by default when you deploy Sitecore XP to the Microsoft Azure App Service.

When you deploy Sitecore is the Microsoft Azure App Service, Sitecore is integrated with the Application Insights service by default. To optimize resource consumption, Sitecore does not collect dependency telemetry events that record information about outgoing HTTP and SQL connections from a Sitecore XP instance. The Application Map feature uses these telemetry events to visualize connections between the services and display diagnostic information.

This topic shows you how to enable the dependency collector and thereby enable the Application Map.

This walkthrough describes how to:

  • Enable the dependency collector for Sitecore roles

  • Enable the dependency collector for xConnect roles

  • Enable the dependency collector for xConnect services

  • Specify component role names for xConnect roles

To enable the collection of dependency telemetry events for Sitecore roles:

  • In the wwwroot folder, uncomment the following line in the ApplicationInsights.config file:

    <!-- <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/> -->
    

To enable the collection of dependency telemetry events for xConnect roles:

  1. In the wwwroot folder, uncomment the following line in the ApplicationInsights.config file:

    <!-- <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/> -->
    
  2. Enable the \CoreServices\sc.AppInsights.Initializer.xml.disabled configuration file by removing the .disabled extension. The sc.AppInsights.Initializer.xml file specifies contains an initializer service that uses the ApplicationInsights.config file to initialize active telemetry configuration.

You have to perform these steps on each XConnect role you want to track. The Microsoft documentation has more information about configuration of Application Insights.

You can configure all currently supported services configured to enable the dependency collector:

  • XConnect Search Indexer

    The XConnect Search Indexer web job is hosted in the xConnect Collection Search role, xp-xc-search/App_Data/jobs/continuous/IndexWorker.

  • Marketing Automation Engine

    The Marketing Automation Engine web job is hosted in the Marketing Automation Operations role, xp-ma-ops/App_Data/jobs/continuous/AutomationEngine.

  • Sitecore Cortex Processing Engine

    The Sitecore Cortex Processing Engine web job is hosted in the Sitecore Cortex Processing role, xp-cortex-processing/App_Data/jobs/continuous/ProcessingEngine.

To enable the collection of dependency telemetry event for xConnect service:

  1. In the root folder of the web job, uncomment the following line in the ApplicationInsights.config file:

    <!-- <Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector"/> -->
    

    This is where you, for example, find the folder and the file for the xConnect Search Indexer (IndexWorker). The file is App_Data\jobs\continuous\IndexWorker\ApplicationInsights.config.

  2. Enable the App_Data\config\sitecore\CoreServices\sc.AppInsights.Initializer.xml.disabled configuration file by removing the .disabled extension. The sc.AppInsights.Initializer.xml file specifies an initializer service that uses the ApplicationInsights.config file to initialize active telemetry configuration.

You have to perform these steps on each XConnect service you want to track. The Microsoft documentation has more information about configuration of Application Insights.

By default, each xConnect role (instance) and service are represented as a separate application node with its own role name.

The role names for the application nodes is specified in the AppSettings.config in the AppInsightsRoleName application setting key. The default deployment contains pre-configured role name setting for each role and service. The role names are taken from the official documentation:

<?xml version="1.0" encoding="utf-8"?>
<appSettings configBuilders="SitecoreAppSettingsBuilder">
  <add key="configurationDirectorRoot" value="~/App_Data" />
  <add key="configurationEnvironment" value="Production" />
  <add key="AllowInvalidClientCertificates" value="True" />
  <add key="validateCertificateThumbprint" value="CBC23042652046E7C7DEF49AAC292A41D98D048" />
  <add key="AppInsightsKey" value="b17beac-e496-8a0f-cf1ff6ab1500" />
  <add key="AppInsightsRoleName" value="XConnect Standalone" />
</appSettings>

You specify the appSettings key in the sc.AppInsights.Initializer.xml configuration file:

<Options>                           
  <InstrumentationKeyAppSettingKey>AppInsightsKey</InstrumentationKeyAppSettingKey>
  <RoleNameAppSettingKey>AppInsightsRoleName</RoleNameAppSettingKey>
</Optiona>