-
Notifications
You must be signed in to change notification settings - Fork 283
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
[sqlclient] Make SqlClientInstrumentation a singleton #2305
[sqlclient] Make SqlClientInstrumentation a singleton #2305
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2305 +/- ##
===========================================
+ Coverage 73.91% 86.36% +12.44%
===========================================
Files 267 8 -259
Lines 9615 330 -9285
===========================================
- Hits 7107 285 -6822
+ Misses 2508 45 -2463
Flags with carried forward coverage won't be shown. Click here to find out more.
|
@alanwest, I do not think that metrics should relay on activities. Please consider sampling scenario. It might lead to dropping measurements. As I remember we have tried this approach in AspNetCore, then changed to separate listeners. |
Metrics will not rely on activities. A single listener will be needed though because when both tracing and metrics are enabled, the duration of the span and metrics must be the same. A stopwatch will be used when only metrics are enabled or the span is sampled. Aspnet core was a bit different as the span is always created by the native instrumentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
In an upcoming PR we will be adding metric instrumentation. That instrumentation will need to leverage the same
DiagnosticSourceListener
that is used for traces. This PR makesSqlClientInstrumentation
a singleton because multiple instances of the instrumentation would create duplicate activities.