Trace Activities from Custom Actions not logged in App Insights
See original GitHub issueDescribe the bug
I am sending trace activities in Custom Action code that the composer bot calls.
await dc.Context.SendActivityAsync(new Activity(type: ActivityTypes.Trace, label: result ? "SmsAction SUCCESS" : "SmsAction FAILED", value: smsMessage));
The custom action is working as expected, and in local development I’m able to see the trace activities (in the emulator and in the WebChat tab in composer.) After deploying to Azure with this in appsettings, I do not see any traces in that App Insights resource:
"telemetry": {
"logActivities": true,
"logPersonalInformation": false,
"options": {
"instrumentationKey": "<key>"
}
},
Version
v2.1.0
Browser
- Electron distribution
- Chrome
- Safari
- Firefox
- Edge
OS
- macOS
- Windows
- Ubuntu
To Reproduce
Steps to reproduce the behavior:
- Use custom action that sends trace activity
- Verify it’s working from your composer dialog
- Deploy to Azure with telemetry settings
- Search App Insights logs for the trace activity
Expected behavior
Trace activity from Custom Action should be logged in App Insights.
Screenshots
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Track custom operations with Application Insights .NET SDK
This article provides guidance on how to track custom operations with the Application Insights SDK. This documentation is relevant for:.
Read more >Application Insights not logging custom events - Stack Overflow
Currently I'm using the Free version of Application Insights. var appInsights = new TelemetryClient(); appInsights. TrackEvent(eventName, ...
Read more >No custom Events or custom Metrics in the App Insights #196
But my problem is that custom Events and custom Metrics in Nodejs SDK do not show up in the charts. There are no...
Read more >Custom Events and Metrics :: Application Insights (5 of 6)
ObjectiveThis course demonstrates the processes for configuring a web application to use Application Insights for performance tracking, log ...
Read more >Structured Logging In Microsoft's Azure Application Insights
This becomes especially critical with automatic logging frameworks/SDKs like Application Insights. Azure Application Insights logs all the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lshade look at this code example for how to log telemetry events within a custom action:
https://github.com/microsoft/botbuilder-dotnet/blob/main/libraries/Microsoft.Bot.Builder.Dialogs.Adaptive/Actions/TelemetryTrackEventAction.cs#L93
Hey @lshade ,
I spoke with a teammate and they informed me that Trace activities are only for debugging and are not logged to App Insights because they contain the entire dialog stack JSON and could have some state data that should not be persisted to the instance.
I think the way to go is to use the TelemetryLoggerMiddleware inside of your custom action – configured with your App Insights credentials.
I will try to confirm this and get more details.