botbuilder-js
botbuilder-js copied to clipboard
DialogContextError showing as multiple Trace entries in Application Insights
Versions
4.13.1 Deployed Azure function bot from Composer
Describe the bug
DialogContextError are split in app insights telemetry logs into multiple entries (see image below)
To Reproduce
Steps to reproduce the behavior:
- Create a Node Azure Functions bot (this is likely not an azure functions runtime issue though)
- Add app insights
- Add code or a dialog to throw a DialogContextError in the bot.
- Message the bot.
- Look for Dialog context error in Telemetry (see image below)
Screenshots
@EricDahlvang, TRACE
events seem to correspond to individual lines of stderr
, i.e. there will be entries for each line of a stack trace. Even a regular console.error(new Error("stderr"))
yields the following in the transaction search log:
That said, using trackException
produces a more useful entry:
This expands to:
I don't think there's anything useful we can do here aside from possibly using the telemetry client to call trackException
in the Bot Adapter onTurnError
handler. What do you think?
That's odd. This would at lest produce a single line in the log: console.log(JSON.stringify(new Error("stderr")))
trackException
looks best though!
It looks like Application Insights is switching to #azure/log soon: https://github.com/microsoft/ApplicationInsights-node.js/pull/733 maybe this will help?
Hi @EricDahlvang and @joshgummersall We tried to reproduce the issue without success, using both a Composer bot and a bot sample.
- Using an Azure function Composer bot locally or deployed, the traces are not being registered in the Application Insights, but shown in BotFramework Emulator.
- Using the 21.corebot-app-insights sample with a simple
console.error(new Error("stderr"))
, thrown when thebeginDialog
is executed and then captured by theonTurnError
handler, the Application Insights showed a singular trace instead of multiple.
Regarding Composer, is there any telemetry configuration we are missing?, causing the traces to not be properly shown in Application Insights? Here is the configuration we used to connect to the Application Insights.
"telemetry": {
"logActivities": true,
"logPersonalInformation": true,
"options": {
"connectionString": "InstrumentationKey=<INSTRUMENTATION_KEY>;IngestionEndpoint=https://westus-0.in.applicationinsights.azure.com/"
}
}