-
Notifications
You must be signed in to change notification settings - Fork 889
[OpenTelemetry] Remove vendored EnvironmentVariablesConfigurationProvider #7146
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
Merged
Kielek
merged 5 commits into
open-telemetry:main
from
stevejgordon:remove-vendored-envvar-config
Jun 24, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
85ab8b5
Remove vendored EnvironmentVariablesConfigurationProvider
stevejgordon 710e583
PR feedback - Remove test collection attribute
stevejgordon 625e12c
PR feedback (nits)
stevejgordon 8a1c421
Fix Prometheus exporter pack
stevejgordon bd44b7f
Update src/OpenTelemetry.Exporter.Prometheus.HttpListener/OpenTelemet…
stevejgordon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 0 additions & 85 deletions
85
src/Shared/EnvironmentVariables/EnvironmentVariablesConfigurationProvider.cs
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
src/Shared/EnvironmentVariables/EnvironmentVariablesConfigurationSource.cs
This file was deleted.
Oops, something went wrong.
52 changes: 0 additions & 52 deletions
52
src/Shared/EnvironmentVariables/EnvironmentVariablesExtensions.cs
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
test/OpenTelemetry.Tests/Resources/EnvironmentVariableResourceIntegrationTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using OpenTelemetry.Trace; | ||
|
|
||
| namespace OpenTelemetry.Resources.Tests; | ||
|
|
||
| public sealed class EnvironmentVariableResourceIntegrationTests | ||
| { | ||
| [Fact] | ||
| public void TracerProvider_PopulatesResourceFromEnvironmentVariables() | ||
| { | ||
| // End-to-end smoke for the env-var > IConfiguration > Resource chain used by | ||
| // ResourceBuilderExtensions.AddEnvironmentVariableDetector. Drives real OTEL | ||
| // spec variables through ResourceBuilder.CreateDefault and reads the live | ||
| // Resource off the built TracerProvider. Catches any regression that breaks | ||
| // the pipeline between Environment and the SDK's exported resource. | ||
| using (EnvironmentVariableScope.Create([ | ||
| ("OTEL_SERVICE_NAME", "e2e-env-var-service"), | ||
| ("OTEL_RESOURCE_ATTRIBUTES", "deployment.environment=test,region=eu-west")])) | ||
| { | ||
| using var tracerProvider = Sdk.CreateTracerProviderBuilder().Build(); | ||
|
|
||
| var attributes = tracerProvider.GetResource().Attributes; | ||
|
|
||
| Assert.Contains(new KeyValuePair<string, object>("service.name", "e2e-env-var-service"), attributes); | ||
| Assert.Contains(new KeyValuePair<string, object>("deployment.environment", "test"), attributes); | ||
| Assert.Contains(new KeyValuePair<string, object>("region", "eu-west"), attributes); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
test/OpenTelemetry.Tests/Shared/EnvVarsCollectionDefinition.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| namespace OpenTelemetry.Tests; | ||
|
|
||
| /// <summary> | ||
| /// Serialization anchor for tests that mutate process-global environment | ||
| /// variables. Tests that set or clear env vars should carry | ||
| /// <c>[Collection(EnvVarsCollectionDefinition.Name)]</c> so they run | ||
| /// sequentially with each other, avoiding cross-class races on shared env | ||
| /// var state. | ||
| /// </summary> | ||
| [CollectionDefinition(Name, DisableParallelization = true)] | ||
| #pragma warning disable CA1515 // xUnit1027 requires [CollectionDefinition] classes to be public. | ||
| public sealed class EnvVarsCollectionDefinition | ||
|
martincostello marked this conversation as resolved.
|
||
| #pragma warning restore CA1515 | ||
| { | ||
| public const string Name = "EnvVars"; | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.