Walkthrough: Enabling Application Map for Application Insights for xConnect
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 to 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 by default. The Application Map feature uses these telemetry events to visualize connections between the services and display diagnostic information.
In Sitecore XP 10.5, do not configure Application Insights by using a standalone instrumentation key setting such as AppInsightsKey. Use the full Application Insights connection string with the AppInsightsConnectionString setting instead.
This topic shows you how to enable the dependency collector and thereby enable the Application Map.
This walkthrough describes how to:
- Configure the Application Insights connection string
- 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
Configure the Application Insights connection string
Before enabling Application Map for xConnect roles and services, configure the Application Insights connection string.
The connection string usually has the following format:
Although the connection string contains an InstrumentationKey value, Sitecore XP 10.5 uses the full connection string through the AppInsightsConnectionString setting.
In each applicable AppSettings.config file, replace the previous standalone instrumentation key setting:
with the following connection string setting:
Replace the placeholder values with the connection string from your Application Insights resource.
Enable the dependency collector for Sitecore roles
To enable the collection of dependency telemetry events for Sitecore roles:
-
In the
wwwrootfolder, uncomment the following line in theApplicationInsights.configfile:After uncommenting, the line should look like this:
Perform this step on each Sitecore role that you want to track in Application Map.
Enable the dependency collector for xConnect roles
To enable the collection of dependency telemetry events for xConnect roles:
-
In the
wwwrootfolder, uncomment the following line in theApplicationInsights.configfile:After uncommenting, the line should look like this:
-
In the role's
AppSettings.configfile, replace the previous instrumentation key setting:with the connection string setting:
-
Keep or update the role name setting as needed:
In Sitecore XP 10.5, you do not need to manually enable or update sc.AppInsights.Initializer.xml for this change. The required initializer configuration is included by default.
You have to perform these steps on each xConnect role you want to track.
Enable the dependency collector for xConnect services
You can enable dependency collection for the supported xConnect services.
The supported services include:
-
XConnect Search Indexer
The XConnect Search Indexer web job is hosted in the xConnect Collection Search role:
-
Marketing Automation Engine
The Marketing Automation Engine web job is hosted in the Marketing Automation Operations role:
-
Sitecore Cortex Processing Engine
The Sitecore Cortex Processing Engine web job is hosted in the Sitecore Cortex Processing role:
To enable the collection of dependency telemetry events for an xConnect service:
-
In the root folder of the web job, uncomment the following line in the
ApplicationInsights.configfile:After uncommenting, the line should look like this:
For example, for the XConnect Search Indexer, the file is located at:
-
In the web job's
AppSettings.configfile, replace the previous instrumentation key setting:with the connection string setting:
-
Keep or update the role name setting as needed:
In Sitecore XP 10.5, you do not need to manually enable or update sc.AppInsights.Initializer.xml for this change. The required initializer configuration is included by default.
You have to perform these steps on each xConnect service you want to track.
Specify component role names for xConnect roles
By default, each xConnect role and service are represented as a separate application node with its own role name.
The role name for the application node is specified in the AppSettings.config file by using the AppInsightsRoleName application setting key. The Application Insights connection string is specified in the same file by using the AppInsightsConnectionString application setting key.
Example:
Do not use the previous standalone instrumentation key setting:
Use the full connection string setting instead: