Improve fiber bound context storage#1270
Merged
brettmc merged 4 commits intoopen-telemetry:mainfrom Apr 8, 2024
Merged
Conversation
Now works properly in fibers once initial context is attached.
`ExecutionContextAwareInterface` should not be relevant for end-users / it was mainly exposed for the FFI fiber handler; calling any of its method with enabled fiber handler would have broken the storage. Swoole context storage README creates a new storage instead of wrapping `Context::storage()`: `Context::setStorage(new SwooleContextStorage(new ContextStorage()));`.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1270 +/- ##
============================================
+ Coverage 77.30% 77.53% +0.22%
- Complexity 2218 2234 +16
============================================
Files 321 321
Lines 6649 6698 +49
============================================
+ Hits 5140 5193 +53
+ Misses 1509 1505 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
brettmc
approved these changes
Apr 7, 2024
weslenteche
approved these changes
Apr 8, 2024
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.
Improves fiber context switching if the FFI fiber handler is not enabled. Now works properly once an initial context is attached within a newly created fiber (e.g. by an event loop wrapper, effectively making
ZendObserverFiberobsolete iff all fibers are created by the event loop).3297127 adds a BC-layer for scenarios like
Context::setStorage(new SwooleContextStorage(Context::storage()));(for example used in #892 (comment)), which is no longer compatible with the newFiberBoundContextStorageimplementation. https://github.com/opentelemetry-php/context-swoole usesContext::setStorage(new SwooleContextStorage(new ContextStorage()));in its README, which is not affected by this change.