Capture your bot's telemetry

APPLIES TO: Composer v1.x and v2.x

Bot Framework Composer enables your bot applications to send event data to a telemetry service such as Application Insights. Telemetry offers insights into your bot by showing which features are used the most, detects unwanted behavior and offers visibility into availability, performance, and usage. In this article you will learn how to implement telemetry into your bot using Application Insights.

Note

You may want to look at the related Bot Framework SDK article Add telemetry to your bot.

Prerequisites

Create an Application Insights resource

Azure Application Insights displays data of your application in a Microsoft Azure resource. Creating a new resource is part of setting up Application Insights to monitor an application. After creating your new resource, you can get its instrumentation key and use it to configure settings in Composer. The instrumentation key links your telemetry to the resource.

Tip

You can learn more about how to create an Application Insight resource and get the Instrumentation key by reading this article.

Update settings in Composer

To connect to your Application Insights resource in Azure, you need to add the instrumentation key to the applicationInsights section of the Project Settings page. To do this:

  1. Go the Project Settings page.

  2. Toggle Advanced Settings View (json) on the right side of the screen.

  3. Find the applicationInsights section, then add your Application Insights instrumentation key to the instrumentationKey setting.

    Bot settings image

Analyze bot's behavior

After making these changes to include the instrumentation key, you can run and interact with your bot to generate telemetry data. To see this telemetry data, navigate to the Logs section of your Application Insights resource in Azure.

For example, if you run a simple specified customEvents as a query, which shows all custom events, but you can narrow down the events or fields you want to see by providing different queries. see Analyze your bot's telemetry data for additional information on creating custom queries.

example query image

As standard you can track a number of events, including bot messages sent or received, LUIS results, dialog events (started / completed / cancelled) and QnA Maker events. Specifically for QnA Maker, you can filter down to events named QnAMakerRecognizerResult, which will include the original query, the top answers from the QmA Maker Knowledge Base and the score etc.

Once you are gathering telemetry from your bot, you can also try using Power BI template, which contains some QnA tabs, to view your data. The template was built for use with the Virtual Assistant template, and you can find details of this here.

Additional information

In Composer, there are two additional settings in the app settings that you need to be aware of: logActivities and logPersonalInformation. logActivities, which is set to true by default, determines if your incoming or outgoing activities are logged. logPersonalInformation, which is set to false by default, determines if more sensitive information is logged. You may see some of the fields blank if you do not enable this.

Additional telemetry settings image

Since Composer 1.1.1 release, Composer features a new action for sending additional events to Application Insights, alongside those that you can automatically capture as described above. Wherever you want to track a custom event, you can add the Emit a telemetry track event action, which can be found under the Debugging Options menu. Once added to your authoring canvas, you specify a custom name for the event, which is the name of the event that will appear in the customEvents table referenced above, along with optionally specifying one or more additional properties to attach to the event.

Track event action

Further reading