There are two methods of configuring your bot. The first assumes you are integrating with Application Insights.
The bot configuration file contains metadata about external services the Bot uses while running (CosmosDB, Application Insights and the Language Understanding (LUIS) service as examples).
If you want "stock" Application Insights, with no additional Application Insights-specific configuration required (for example Telemetry Initializers), pass in the bot configuration object during initialization. This is the easiest method to initialize and will configure Application Insights to begin tracking Requests, external calls to other services, and correlating events across services.
ASP.Net Core - Startup.cs
public void ConfigureServices(IServiceCollection services)
{
...
// Add Application Insights - pass in the bot configuration
services.AddBotApplicationInsights(botConfig);
...
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseBotApplicationInsights()
...
.UseDefaultFiles()
.UseStaticFiles()
.UseBotFramework();
Node.js
const appInsightsClient = new ApplicationInsightsTelemetryClient(botConfig);
What if your bot configuration doesn't contain Application Insights? No problem, it defaults to a null client which no-ops the method calls.
Have multiple Application Insight sections in your bot configuration? You can designate which instance of the Application Insights service you want to use inside your bot configuration.
ASP.Net Core
public void ConfigureServices(IServiceCollection services)
{
// Add Application Insights
services.AddBotApplicationInsights(botConfig, "myAppInsights");
Node.js
const appInsightsClient = new ApplicationInsightsTelemetryClient(botConfig);
If you want to customize your Application Insights client, or you want to log into a completely separate service, you have to configure the system differently.
ASP.Net Core
csharp
public void ConfigureServices(IServiceCollection services)
{
...
// Create Application Insight Telemetry Client
// with custom configuration.
var telemetryClient = TelemetryClient(myCustomConfiguration)
// Add Application Insights
services.AddBotApplicationInsights(new BotTelemetryClient(telemetryClient), "InstrumentationKey");
Node.js
const appInsightsClient = new ApplicationInsightsTelemetryClient(botConfig);
If you want to log telemetry events generated by the Bot Framework into a completely separate system, create a new class derived from the base interface and configure.
ASP.Net Core
csharp
public void ConfigureServices(IServiceCollection services)
{
...
// Create my IBotTelemetryClient-based logger
var myTelemetryClient = MyTelemetryLogger();
// Add Application Insights
services.AddBotApplicationInsights(myTelemetryClient);
Node.js
const appInsightsClient = new ApplicationInsightsTelemetryClient(botConfig);
The Bot Framework SDK provides an Application Inisghts Telemetry Initializer to log important identifiers in all custom events.
Property | Value |
---|---|
user_id |
ChannelId + From.Id |
session_id |
ConversationId |
customDimensions.activityId |
The bot activity Id |
customDimensions.activityType |
The bot activity type |
customDimensions.channelId |
The bot activity channel Id |
Logs activites sent from users to the bot
Logged From: TelemetryLoggerMiddleware
Property | Value |
---|---|
user_id |
From Telemetry Initializer |
session_id |
From Telemetry Initializer |
customDimensions.activityId |
From Telemetry Initializer |
customDimensions.activityType |
From Telemetry Initializer |
customDimensions.channelId |
From Telemetry Initializer |
customDimensions.conversationName |
Conversation.Name |
customDimensions.locale |
Locale |
customDimensions.recipientId |
Recipient.Id |
customDimensions.recipientName |
Recipient.Name |
customDimensions.fromId |
From.Id |
customDimensions.replyActivityId |
Reply to ID |
customDimensions.text |
Text |
Logs activites sent from the bot to their users
Logged From: TelemetryLoggerMiddleware
Property | Value |
---|---|
user_id |
From Telemetry Initializer |
session_id |
From Telemetry Initializer |
customDimensions.activityId |
From Telemetry Initializer |
customDimensions.activityType |
From Telemetry Initializer |
customDimensions.channelId |
From Telemetry Initializer |
customDimensions.conversationName |
Conversation.Name |
customDimensions.locale |
Locale |
customDimensions.recipientId |
Recipient.Id |
customDimensions.recipientName |
Recipient.Name |
customDimensions.fromId |
From.Id |
customDimensions.fromName |
From.Name |
customDimensions.text |
Text |
Logs Language Understanding Service results
Logged from: TelemetryLuisRecognizer
Property | Value |
---|---|
user_id |
From Telemetry Initializer |
session_id |
From Telemetry Initializer |
customDimensions.activityId |
From Telemetry Initializer |
customDimensions.activityType |
From Telemetry Initializer |
customDimensions.channelId |
From Telemetry Initializer |
customDimensions.DialogId |
ActiveDialog.Id |
customDimensions.fromId |
From.Id |
customDimensions.question |
Text |
customDimensions.applicationId |
LUIS application Id |
customDimensions.intent |
The top intent |
customDimensions.intentScore |
The top intent's score |
customDimensions.entities |
Matched entities |
customDimensions.sentimentLabel |
LUIS sentiment analysis label |
customDimensions.sentimentScore |
LUIS sentiment analysis score |
Logs QnA Maker results
Logged from: TelemetryQnAMaker
Property | Value |
---|---|
user_id |
From Telemetry Initializer |
session_id |
From Telemetry Initializer |
customDimensions.activityId |
From Telemetry Initializer |
customDimensions.activityType |
From Telemetry Initializer |
customDimensions.channelId |
From Telemetry Initializer |
customDimensions.knowledgeBaseId |
QnA Knowledge Base Id |
customDimensions.originalQuestion |
Text |
customDimensions.question |
Serialized JSON of matched QnA questions |
customDimensions.questionId |
QnA question Id |
customDimensions.score |
QnA score |
customDimensions.answer |
QnA answer text |
customDimensions.articleFound |
Boolean if an article is found |
Logs when a waterfall dialog starts.
Logged from: SDK when TelemetryClient is configured
Property | Value |
---|---|
user_id |
From Telemetry Initializer |
session_id |
From Telemetry Initializer |
customDimensions.activityId |
From Telemetry Initializer |
customDimensions.activityType |
From Telemetry Initializer |
customDimensions.channelId |
From Telemetry Initializer |
customDimensions.DialogId |
ActiveDialog.Id passed into the waterfall dialog |
customDimensions.InstanceId |
Unique per dialog instance |
Logs inidividual steps of a waterfall dialog. Step numbers may be skipped if no prompt is performed within the step.
Logged from: SDK when TelemetryClient is configured
Property | Value |
---|---|
user_id |
From Telemetry Initializer |
session_id |
From Telemetry Initializer |
customDimensions.activityId |
From Telemetry Initializer |
customDimensions.activityType |
From Telemetry Initializer |
customDimensions.channelId |
From Telemetry Initializer |
customDimensions.DialogId |
ActiveDialog.Id passed into the waterfall dialog |
customDimensions.StepName |
Method name or StepXofY if lambda |
customDimensions.InstanceId |
Unique per dialog instance |
Logs when a waterfall dialog is canceled.
Logged from: SDK when TelemetryClient is configured
Property | Value |
---|---|
user_id |
From Telemetry Initializer |
session_id |
From Telemetry Initializer |
customDimensions.activityId |
From Telemetry Initializer |
customDimensions.activityType |
From Telemetry Initializer |
customDimensions.channelId |
From Telemetry Initializer |
customDimensions.DialogId |
ActiveDialog.Id passed into the waterfall dialog |
customDimensions.StepName |
Method name or StepXofY if lambda |
customDimensions.InstanceId |
Unique per dialog instance |
Logs when a waterfall dialog is complete.
Logged from: SDK when TelemetryClient is configured
Property | Value |
---|---|
user_id |
From Telemetry Initializer |
session_id |
From Telemetry Initializer |
customDimensions.activityId |
From Telemetry Initializer |
customDimensions.activityType |
From Telemetry Initializer |
customDimensions.channelId |
From Telemetry Initializer |
customDimensions.DialogId |
ActiveDialog.Id passed into the waterfall dialog |
customDimensions.StepName |
Step name that the waterfall dialog was currently progressed to |
customDimensions.InstanceId |
Unique per dialog instance |