fix: change Environment Var parsing to not throw FormatException (part1)#4095
Merged
cijothomas merged 3 commits intoopen-telemetry:mainfrom Jan 21, 2023
TimothyMothra:3690_remove_FormatException
Merged
fix: change Environment Var parsing to not throw FormatException (part1)#4095cijothomas merged 3 commits intoopen-telemetry:mainfrom TimothyMothra:3690_remove_FormatException
cijothomas merged 3 commits intoopen-telemetry:mainfrom
TimothyMothra:3690_remove_FormatException
Conversation
reyang
reviewed
Jan 21, 2023
| { | ||
| throw new FormatException($"{key} environment variable has an invalid value: '{stringValue}'"); | ||
| OpenTelemetrySdkEventSource.Log.InvalidEnvironmentVariable(key, stringValue); | ||
| value = default; |
Member
There was a problem hiding this comment.
Should value be touched here? (I guess no)
Author
There was a problem hiding this comment.
good catch! it's an out param so it needs to be set, but it's already been set by the Try method in the if statement.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4095 +/- ##
==========================================
- Coverage 85.67% 85.57% -0.11%
==========================================
Files 289 289
Lines 11256 11261 +5
==========================================
- Hits 9644 9637 -7
- Misses 1612 1624 +12
|
cijothomas
approved these changes
Jan 21, 2023
3 tasks
1 task
2 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Towards #3690
In this PR, I changed the TryParse to NOT throw
FormatExceptionand instead log to EventSource.Unit tests and documentation will be fixed in a follow up PR to keep the PR a reasonable size.
Changes
ConfigurationExtensionsremove throw FormatException and instead log a Warning in EventSource.
Please provide a brief description of the changes here.
For significant contributions please make sure you have completed the following items:
CHANGELOG.mdupdated for non-trivial changes