Skip to content

Hivebots/botbuilder-instrumentation

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adding Logging to an Existing bot

Follow these steps:

Connect to Application Insights

  1. Create an Application Insights service under your subscription.
  2. Use the Instrumentation Key inside your bot registration page under Instrumentation key.
  3. Under the App Insights serivce, go to API Access and copy Application ID
  4. Under the App Insights serivce, go to API Access >> New Key with Read permissions and copy Api Key.

Connect to Cognitive Services

Create a new Sentiment Analisys Service under Cognitive Services. When creating the service, make sure to mark Text Analytics - Preview.

Setting Environment Variables

APPINSIGHTS_INSTRUMENTATIONKEY={App Insights Instrumentation Key}
CG_SENTIMENT_KEY={Cognitive Services Text Analytics Key}

Connecting to Code

var instrumentation = require('botbuilder-instrumentation');

// Setting up advanced instrumentation
let logging = new instrumentation.BotFrameworkInstrumentation({ 
  instrumentationKey: process.env.APPINSIGHTS_INSTRUMENTATIONKEY,
  sentimentKey: process.env.CG_SENTIMENT_KEY,
});
logging.monitor(bot);

You can see a working sample in https://github.com/morsh/bot-with-instrumentation

About

Add extra logging for bot framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 51.6%
  • JavaScript 48.4%