-
Notifications
You must be signed in to change notification settings - Fork 862
fix: change Environment Var parsing to not throw FormatException (part1) #4095
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
fix: change Environment Var parsing to not throw FormatException (part1) #4095
Conversation
| { | ||
| throw new FormatException($"{key} environment variable has an invalid value: '{stringValue}'"); | ||
| OpenTelemetrySdkEventSource.Log.InvalidEnvironmentVariable(key, stringValue); | ||
| value = default; |
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.
Should value be touched here? (I guess no)
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.
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.
reyang
left a comment
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.
LGTM.
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
|
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