-
Notifications
You must be signed in to change notification settings - Fork 793
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
ApplicationInsightsPublisher: TelemetryClient from DI #186
Labels
Comments
Can you send a PR with this change? |
CarlosLanderas
added a commit
to CarlosLanderas/AspNetCore.Diagnostics.HealthChecks
that referenced
this issue
Jun 26, 2019
…tion for Telemetry Client
CarlosLanderas
added a commit
to CarlosLanderas/AspNetCore.Diagnostics.HealthChecks
that referenced
this issue
Jun 26, 2019
…tion for Telemetry Client
CarlosLanderas
added a commit
to CarlosLanderas/AspNetCore.Diagnostics.HealthChecks
that referenced
this issue
Jun 26, 2019
…tion for Telemetry Client
Hello @espenrl, I was preparing a PR for this but after talking with @unaizorrilla this behaviour is on purpose. Users might want to use default telemetry client for application monitoring and a different client for health checks monitoring. If you don't provide a telemetry key the health check will use the active telemetry configuration. |
sungam3r
added
applicationinsights
and removed
help wanted
Extra attention is needed
labels
Jul 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
The ApplicationInsightsPublisher instantiates its own TelemetryClient. According to Microsoft documentation the best practice is to get it using the one in the DI container. And then it could me made a readonly field instead of static field with a lock.
https://github.com/Microsoft/ApplicationInsights-aspnetcore/wiki/Custom-Configuration
AspNetCore.Diagnostics.HealthChecks/src/HealthChecks.Publisher.ApplicationInsights/ApplicationInsightsPublisher.cs
Lines 22 to 23 in 2d867c9
AspNetCore.Diagnostics.HealthChecks/src/HealthChecks.Publisher.ApplicationInsights/ApplicationInsightsPublisher.cs
Lines 85 to 105 in 2d867c9
The text was updated successfully, but these errors were encountered: