Add support for OTEL_SDK_DISABLED environment variable#6568
Add support for OTEL_SDK_DISABLED environment variable#6568rajkumar-rangaraj merged 22 commits intoopen-telemetry:mainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6568 +/- ##
==========================================
- Coverage 86.77% 86.75% -0.03%
==========================================
Files 258 258
Lines 11973 12027 +54
==========================================
+ Hits 10390 10434 +44
- Misses 1583 1593 +10
Flags with carried forward coverage won't be shown. Click here to find out more.
|
…ahhaering/opentelemetry-dotnet into support-sdk-disabled-envVar
test/OpenTelemetry.Tests/Logs/LoggerProviderBuilderBaseTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Martin Costello <martin@martincostello.com>
| public LoggerProviderBuilderBaseTests() | ||
| { | ||
| Environment.SetEnvironmentVariable(SdkConfigDefinitions.SdkDisableEnvVarName, null); | ||
| } | ||
|
|
||
| public void Dispose() | ||
| { | ||
| Environment.SetEnvironmentVariable(SdkConfigDefinitions.SdkDisableEnvVarName, null); | ||
| GC.SuppressFinalize(this); | ||
| } |
There was a problem hiding this comment.
A better way to do this, IMHO, would be to:
- Not set the value in the constructor
- Let the test set the value it's interested in
- Set it back to the original value when being disposed
You could use a similar pattern to this to implement it in a cross-cutting way, then the usage would be something like:
using (new EnvironmentVariableScope("OTEL_SDK_DISABLED", value))
{
var builder = new LoggerProviderBuilderBase();
using var provider = builder.Build();
Assert.IsType(expected, provider);
}There was a problem hiding this comment.
Thanks for the suggestion, I've done that.
Is there any way I can retry the workflow without a commit? Sometimes the build fails even though I have no errors (like right now).
There was a problem hiding this comment.
Not without write access to the repo, no.
test/OpenTelemetry.Tests/Logs/LoggerProviderBuilderBaseTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Martin Costello <martin@martincostello.com>
|
@CodeBlanch Would you mind taking a look at this please? |
|
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. |
Fixes #4155
Changes
Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial changes