-
Notifications
You must be signed in to change notification settings - Fork 765
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
Disable flag for TracerProvider / MeterProvider #3583
Disable flag for TracerProvider / MeterProvider #3583
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #3583 +/- ##
==========================================
- Coverage 87.35% 87.23% -0.13%
==========================================
Files 282 282
Lines 10132 10137 +5
==========================================
- Hits 8851 8843 -8
- Misses 1281 1294 +13
|
@rajkumar-rangaraj Would you be open to working on this after #3533 is done? I'm in the middle of changing this stuff not totally sure how this will fit in. |
@CodeBlanch sure, I will wait for #3533 to complete. |
This PR was marked stale due to lack of activity and will be closed in 7 days. Commenting or Pushing will instruct the bot to automatically remove the label. This bot runs once per day. |
@rajkumar-rangaraj I see that #3533 is merged. Can you please double-check and clarify if it is ready for review? |
|
||
// Builds noop MeterProvider when this flag is set. | ||
// This flag is controlled through reflection. | ||
private static bool disableMeterProviderBuilder = false; |
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.
Is there a scenario where metrics/traces need to be disabled independently?
What is the contract and how to maintain the contract?
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.
Maybe consider something similar to
// An integer value which controls whether instrumentation should be suppressed (disabled). | |
// * 0: instrumentation is not suppressed | |
// * [int.MinValue, -1]: instrumentation is always suppressed | |
// * [1, int.MaxValue]: instrumentation is suppressed in a reference-counting mode | |
private static readonly RuntimeContextSlot<int> Slot = RuntimeContext.RegisterSlot<int>("otel.suppress_instrumentation"); |
Will be addressed through #3639 |
Fixes #3455 .
Changes
Added disable flag in
MeterProviderBuilderBase
andTracerProviderBuilderBase
. When disable flag is set, builder will create a defaultMeterProvider
orTracerProvider
. From OpenTelemetry Auto-Instrumentation this could be controlled through reflection.For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes@open-telemetry/dotnet-instrumentation-approvers , FYI.