-
Couldn't load subscription status.
- Fork 123
[FileBasedConfiguration] General Settings #4481
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 16 commits into
open-telemetry:main
from
ysolomchenko:FileBasedConfiguration-General/FailFast
Oct 6, 2025
Merged
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
74f5b2d
[File-Based] Add General Settings
ysolomchenko 854a5a4
[File-Based] Add FailFast Settings
ysolomchenko 2dd4a74
Merge branch 'main' into FileBasedConfiguration-General/FailFast
ysolomchenko 584c20c
[FileBased] Add General+failfast Tests
ysolomchenko c5f6c2d
Merge branch 'main' into FileBasedConfiguration-General/FailFast
ysolomchenko 8337bd4
Fallback to env vars uses file-based configuration
ysolomchenko 89099dc
Merge branch 'main' into FileBasedConfiguration-General/FailFast
ysolomchenko 325ee5c
[File-Based] Add general configuration docs
ysolomchenko de0ed91
Merge branch 'main' into FileBasedConfiguration-General/FailFast
ysolomchenko 1c2596b
[File-Based] Add profiling configuration
ysolomchenko c960a5f
fix spacing
ysolomchenko e00b4cb
Merge branch 'main' into FileBasedConfiguration-General/FailFast
ysolomchenko 9596695
fix
ysolomchenko 88acb11
Set Profiler from env var
ysolomchenko b380a12
add comment
ysolomchenko fc982c1
Merge branch 'main' into FileBasedConfiguration-General/FailFast
ysolomchenko 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
Some comments aren't visible on the classic Files Changed page.
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
43 changes: 43 additions & 0 deletions
43
...metry.AutoInstrumentation.Tests/Configurations/FileBased/FilebasedGeneralSettingsTests.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,43 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using OpenTelemetry.AutoInstrumentation.Configurations; | ||
| using OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration; | ||
| using Xunit; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Tests.Configurations.FileBased; | ||
|
|
||
| public class FilebasedGeneralSettingsTests | ||
| { | ||
| [Fact] | ||
| public void LoadFile_GeneralSettings() | ||
| { | ||
| var conf = new YamlConfiguration | ||
| { | ||
| Disabled = false, | ||
| FlushOnUnhandledException = true, | ||
| }; | ||
|
|
||
| var settings = new GeneralSettings(); | ||
|
|
||
| settings.LoadFile(conf); | ||
|
|
||
| Assert.True(settings.SetupSdk); | ||
| Assert.True(settings.FlushOnUnhandledException); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void LoadFile_FailFastSettings() | ||
| { | ||
| var conf = new YamlConfiguration | ||
| { | ||
| FailFast = true, | ||
| }; | ||
|
|
||
| var settings = new FailFastSettings(); | ||
|
|
||
| settings.LoadFile(conf); | ||
|
|
||
| Assert.True(settings.FailFast); | ||
| } | ||
| } |
5 changes: 5 additions & 0 deletions
5
...enTelemetry.AutoInstrumentation.Tests/Configurations/FileBased/Files/TestGeneralFile.yaml
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,5 @@ | ||
| file_format: "1.0-rc.1" | ||
| disabled: false | ||
| fail_fast: false | ||
| flush_on_unhandled_exception: false | ||
|
|
5 changes: 5 additions & 0 deletions
5
...etry.AutoInstrumentation.Tests/Configurations/FileBased/Files/TestGeneralFileEnvVars.yaml
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,5 @@ | ||
| file_format: "1.0-rc.1" | ||
| disabled: ${OTEL_SDK_DISABLED} | ||
| fail_fast: ${OTEL_DOTNET_AUTO_FAIL_FAST_ENABLED} | ||
| flush_on_unhandled_exception: ${OTEL_DOTNET_AUTO_FLUSH_ON_UNHANDLEDEXCEPTION} | ||
|
|
41 changes: 41 additions & 0 deletions
41
...Telemetry.AutoInstrumentation.Tests/Configurations/FileBased/Parser/ParserGeneralTests.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,41 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using Xunit; | ||
| using YamlParser = OpenTelemetry.AutoInstrumentation.Configurations.FileBasedConfiguration.Parser.Parser; | ||
|
|
||
| namespace OpenTelemetry.AutoInstrumentation.Tests.Configurations.FileBased.Parser; | ||
|
|
||
| [Collection("Non-Parallel Collection")] | ||
| public class ParserGeneralTests | ||
| { | ||
| [Fact] | ||
| public void Parse_FullConfigYaml_ShouldPopulateModelCorrectly() | ||
| { | ||
| var config = YamlParser.ParseYaml("Configurations/FileBased/Files/TestGeneralFile.yaml"); | ||
|
|
||
| Assert.NotNull(config); | ||
|
|
||
| Assert.Equal("1.0-rc.1", config.FileFormat); | ||
| Assert.False(config.Disabled); | ||
| Assert.False(config.FailFast); | ||
| Assert.False(config.FlushOnUnhandledException); | ||
| } | ||
|
|
||
| [Fact] | ||
| public void Parse_EnvVarYaml_ShouldPopulateModelCompletely() | ||
| { | ||
| Environment.SetEnvironmentVariable("OTEL_SDK_DISABLED", "true"); | ||
| Environment.SetEnvironmentVariable("OTEL_DOTNET_AUTO_FAIL_FAST_ENABLED", "true"); | ||
| Environment.SetEnvironmentVariable("OTEL_DOTNET_AUTO_FLUSH_ON_UNHANDLEDEXCEPTION", "false"); | ||
|
|
||
| var config = YamlParser.ParseYaml("Configurations/FileBased/Files/TestGeneralFileEnvVars.yaml"); | ||
|
|
||
| Assert.NotNull(config); | ||
|
|
||
| Assert.Equal("1.0-rc.1", config.FileFormat); | ||
| Assert.True(config.Disabled); | ||
| Assert.True(config.FailFast); | ||
| Assert.False(config.FlushOnUnhandledException); | ||
| } | ||
| } |
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
Oops, something went wrong.
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.
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.
Mandatory for this PR: You need to set up here also ProfilerEnabled (by fallback to envs).
Plugins are alsoe required, but it can be configured also from the file. If you want to make a follow up PR, you need to ensure that it is extracted to separate setting, and readed from EvnVars.
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.
Plugins will be added in separate PR.