Add thread safety to SimpleSpanProcessor#358
Merged
reyang merged 2 commits intoopen-telemetry:masterfrom Oct 12, 2020
Merged
Conversation
Contributor
Author
|
@pyohannes let me know if this is in line with what you were thinking! |
Codecov Report
@@ Coverage Diff @@
## master #358 +/- ##
==========================================
- Coverage 94.95% 94.90% -0.05%
==========================================
Files 154 155 +1
Lines 6854 6874 +20
==========================================
+ Hits 6508 6524 +16
- Misses 346 350 +4
|
ThomsonTan
reviewed
Oct 8, 2020
pyohannes
reviewed
Oct 8, 2020
pyohannes
reviewed
Oct 8, 2020
3b2fa83 to
d8ce956
Compare
6 tasks
reyang
reviewed
Oct 12, 2020
reyang
reviewed
Oct 12, 2020
ThomsonTan
reviewed
Oct 12, 2020
pyohannes
approved these changes
Oct 12, 2020
Contributor
pyohannes
left a comment
There was a problem hiding this comment.
Looks good, and improves the quality of our code base. Thanks!
I only have one nit, but this is ready to merge.
…exporter usage in SimpleProcessor. - Add generic SpinLockMutex and modify code using spin-locks to make use of it and std::lock_guard - Update existing spin-lock usage - add thread safe usage of Exporter in SimpleSpanProcessor. - Ensure shutdown is only called once.
1a071af to
7512d6c
Compare
lalitb
approved these changes
Oct 12, 2020
| } | ||
| /** Releases the lock held by the execution agent. Throws no exceptions. */ | ||
| void unlock() noexcept { flag_.clear(std::memory_order_release); } | ||
|
|
Member
There was a problem hiding this comment.
Nit: We can also add a try_lock() method (as provided by std::mutex ) which returns immediately with status. It will provide flexibility to caller whether try acquiring in tight loop, or lazy way . This mayn't be usable through lock_guard, but still useful if caller is not concerned about RAII. Something like:
bool try_lock() { return !flag_.test_and_set(std::memory_order_acquire)) }
ThomsonTan
approved these changes
Oct 12, 2020
GerHobbelt
pushed a commit
to GerHobbelt/opentelemetry-cpp
that referenced
this pull request
Aug 31, 2025
…wnload-artifact-digest Update actions/download-artifact digest to 448e3f8
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.

Changes:
Exporterare locked behind an atomic_flag.Notes:
*Providerclasses that do similar spin-locking.