Repository navigation
[SDK] make global log level atomic - #4368
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4368 +/- ##
==========================================
+ Coverage 81.77% 81.78% +0.01%
==========================================
Files 493 493
Lines 19456 19474 +18
==========================================
+ Hits 15909 15924 +15
- Misses 3547 3550 +3
🚀 New features to boost your workflow:
|
dbarker
marked this pull request as ready for review
August 5, 2026 22:55
Member
|
Thanks for the fix. This is a bug in the production code, because changing the log level dynamically while an application is running is valid, and expected. Risk analysis: Consequences when not fixing thisUser applications will see TSAN data races, as reported. An instrumented application thread may not be responsive to log level changes, only noticing the change "eventually".
Consequences when fixing thisPossible concern with performance overhead, using an atomic instead of a plain read. Analysis:
My assessment is that we should fix this, per this PR. |
2 of 3 tasks
1 task
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.
Fixes # (issue)
#4367 runs the configuration example with user extension components that each log to the global logger. This exposed a race condition when two threads read/write to the global log level at the same time.
SUMMARY: ThreadSanitizer: data race (/home/runner/.cache/bazel/e6b8d6759295e14b76bc8cb98b604748/execroot/_main/bazel-out/k8-fastbuild-tsan/bin/examples/configuration/../../_solib_k8/libsdk_Ssrc_Scommon_Slibglobal_Ulog_Uhandler.so+0x6182) (BuildId: 3f249d24e0f37758df7e7d69675545906815d63d) in opentelemetry::v1::sdk::common::internal_log::GlobalLogHandler::SetLogLevel(opentelemetry::v1::sdk::common::internal_log::LogLevel)TSAN detailed log
Changes
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