Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Register IBotTelemetryClient and add telemetry initializer middleware… #2916

Merged
merged 10 commits into from
May 8, 2020

Conversation

garypretty
Copy link
Contributor

Fixes #2915 - registers the IBotTelemetryClient and adds the TelemetryInitializerMiddleware to the pipeline of the adapter.

@github-actions
Copy link

github-actions bot commented May 6, 2020

Coverage Status

Coverage remained the same at 0.0% when pulling 41b49d1 on gary/runtime-telemetry-fix into 70b9715 on master.

@benbrown benbrown changed the title Register IBotTelemetryClient and add telemetry initializer middleware… fix: Register IBotTelemetryClient and add telemetry initializer middleware… May 6, 2020
});
services.AddSingleton<IBotTelemetryClient, BotTelemetryClient>();

var sp = services.BuildServiceProvider();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The github actions is issuing some good advice. This is expensive to run, please remove it. Instead, in line 169 you can do s.getservice there which is a factory method and will be called after the service provider is built.

If you need to use the telemetry somehwere else, just do as we did with the bot and use the factory method instead of the instance method to do deferred resolution. Ping me if you want to chat more about this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I had done this for passing in TelemetryInitializerMiddleware on line 160, but missed the fact that I had access to the service provider here (which I didn't think I did). Thanks for the catch. I'll amend now,

runtime/dotnet/azurewebapp/Startup.cs Show resolved Hide resolved
carlosscastro
carlosscastro previously approved these changes May 8, 2020
@cwhitten cwhitten merged commit 819ede5 into master May 8, 2020
@cwhitten cwhitten deleted the gary/runtime-telemetry-fix branch May 8, 2020 17:42
lei9444 pushed a commit to lei9444/BotFramework-Composer-1 that referenced this pull request Jun 15, 2021
…eware… (microsoft#2916)

* Register IBotTelemetryClient and add telemetry initializer middleware to the adapter pipeline

* Update functions telemetry config and amend webapp implementaton

* Remove yarn.lock

* Pass instrumentation key to AddBotApplicationInsights method

* Explicitly pass the instrumentation key in functions runtime

* Fix issues introduced in merge

Co-authored-by: Ben Brown <benbro@microsoft.com>
Co-authored-by: Chris Whitten <christopher.whitten@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants