fix_otlp_timeout_parsing_fallback#5448
Open
Eason09053360 wants to merge 3 commits into
Open
Conversation
herin049
reviewed
Jul 23, 2026
| return float(value) | ||
| except ValueError: | ||
| _logger.warning( | ||
| "Invalid value %r for %s, ignoring it.", value, environ_key |
Contributor
There was a problem hiding this comment.
Can we rephrase this a bit, and include the name of the environment variable?
Contributor
Author
There was a problem hiding this comment.
Can we rephrase this a bit, and include the name of the environment variable?
Thanks for reviewing!
applied It is clearer now.
|
|
||
| class TestTimeoutFromEnv(unittest.TestCase): | ||
| @patch.dict("os.environ", {"TEST_TIMEOUT": "15"}) | ||
| def test_valid_value(self): |
Contributor
There was a problem hiding this comment.
We can probably combine all of these tests into a single parameterized test.
- Clarify the invalid-value warning by spelling out "environment variable" instead of a bare %s substitution. - Combine test_valid_value/test_unset_returns_default/ test_empty_value_returns_default into a single table-driven test_simple_cases using subTest.
Eason09053360
force-pushed
the
fix-otlp-env-timeout-fallback
branch
from
July 24, 2026 00:59
3baee13 to
76c758f
Compare
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.
Description
The OTLP exporters parse their timeout env vars with a bare
float()in__init__, so an invalid value likeOTEL_EXPORTER_OTLP_TIMEOUT=10s— or a declared-but-empty variable — raisesValueErrorduring exporter construction and takes down SDK startup.This adds a shared
_timeout_from_env()helper inopentelemetry-exporter-otlp-proto-commonthat warns and falls back to the default instead, matching how the repo already handles invalid temporality and export-interval values. Applied to all six call sites (HTTP trace/metric/log, gRPC mixin, gRPC trace/metric/log); precedence is unchanged.Also fixes
timeout or ...silently discarding an explicittimeout=0; it is nowtimeout is not None.Type of change
How Has This Been Tested?
Does This PR Require a Contrib Repo Change?
Checklist: