question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't use TelemetryTrackEvent actions

See original GitHub issue

Describe the bug

I have a super simple echo bot (fresh out of the template) with an extra action to send a custom telemetry event to application insights with the input from the user, however it doesn’t work. When trying the bot in the emulator I get a 500 error, and when running the project without the composer I get the following message:

`fail: Microsoft.AspNetCore.Server.Kestrel[13] Connection id “0HM35SOKSNO2T”, Request id “0HM35SOKSNO2T:00000001”: An unhandled exception was thrown by the application. System.Exception: echobot-1.dialog error: Type Microsoft.TelemetryTrackEvent not registered in factory.

at Microsoft.Bot.Builder.Dialogs.Declarative.Resources.ResourceExplorer.LoadTypeAsync[T](Resource resource, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.Declarative.Resources.ResourceExplorer.LoadType[T](Resource resource) at Microsoft.BotFramework.Composer.Core.ComposerBot.LoadRootDialogAsync() in /Users/rafael.quesada/Projects/bot_builder_template_tests/EchoBot-1/runtime/core/ComposerBot.cs:line 69 at Microsoft.BotFramework.Composer.Core.ComposerBot…ctor(ConversationState conversationState, UserState userState, ResourceExplorer resourceExplorer, BotFrameworkClient skillClient, SkillConversationIdFactoryBase conversationIdFactory, IBotTelemetryClient telemetryClient, String rootDialog, String defaultLocale, Boolean removeRecipientMention) in /Users/rafael.quesada/Projects/bot_builder_template_tests/EchoBot-1/runtime/core/ComposerBot.cs:line 43 at Microsoft.BotFramework.Composer.WebAppTemplates.Startup.<>c__DisplayClass12_0.b__4(IServiceProvider s) in /Users/rafael.quesada/Projects/bot_builder_template_tests/EchoBot-1/runtime/azurewebapp/Startup.cs:line 187 at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired) at lambda_method(Closure , IServiceProvider , Object[] ) at Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider.<>c__DisplayClass4_0.b__0(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.g__CreateController|0(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() — End of stack trace from previous location where exception was thrown — at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker) at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application)`

I haven’t done any customizations to the runtime and the docs don’t point to anything I might be doing wrong, am I missing something here? I should mention that I do receive other traces in app insights, so it seems to be properly configured.

Version

1.1.1

Browser

  • Electron distribution
  • Chrome
  • Safari
  • Firefox
  • Edge

OS

  • macOS
  • Windows
  • Ubuntu

To Reproduce

Steps to reproduce the behavior:

  1. Create a new bot with the echo bot template
  2. Add a new action in the Unknown intent trigger after the bot response with property “input” and value “=turn.activity.text”
  3. Start the bot and try it out in the emulator, should receive an error 500

Expected behavior

When using a custom telemetry event, it should be sent to application insights and appear when querying the logs.

Screenshots

  1. Composer: Screenshot 2020-10-01 at 10 55 11
  2. Emulator: Screenshot 2020-10-01 at 10 56 22

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
RafaelQuesadacommented, Oct 13, 2020

Thanks @luhan2017, works like a charm!

1reaction
luhan2017commented, Oct 10, 2020

This is because the schema and code mismatch. In schema, the action is called “TelemetryTrackEvent”, but in code it is declared as “TelemetryTrackEventAction”, I will submit a PR in the sdk side to fix this issue.

You are mitigate this issue by update your dialog file. @RafaelQuesada Click show code, and replace “$kind”: “Microsoft.TelemetryTrackEvent” with “$kind”: “Microsoft.TelemetryTrackEventAction”, then Restart your bot, it will work.

@cwhitten @garypretty,I will submit a PR to fix this in the sdk side.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Application Insights API for custom events and metrics
Use the Application Insights core telemetry API to send custom events and metrics and your own versions of ... TrackEvent, User actions and...
Read more >
Application Insights not logging custom events - Stack Overflow
Currently I'm using the Free version of Application Insights. The is very straight forward var appInsights = new TelemetryClient(); appInsights.
Read more >
Event correlation in Application Insights - Andrei Dzimchuk
So for any TelemetryClient instance that we create in scope of a request we're going to be using RequestTelemetry.Id property value as an ......
Read more >
Implementing Monitoring in React Using AppInsights
AppInsights (Application Insights in its long-form) is part of the Azure ... To do this we can use the trackEvent custom metric tracking: ......
Read more >
Custom Events and Metrics :: Application Insights (5 of 6)
... try restarting your device. Your browser can't play this video. ... Part 3 - Reviewing and Deciphering Application Insights Telemetry ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found