Skip to content
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

Improve fiber bound context storage #1270

Conversation

Nevay
Copy link
Contributor

@Nevay Nevay commented Apr 5, 2024

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 ZendObserverFiber obsolete 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 new FiberBoundContextStorage implementation. https://github.com/opentelemetry-php/context-swoole uses Context::setStorage(new SwooleContextStorage(new ContextStorage())); in its README, which is not affected by this change.

Nevay added 3 commits April 5, 2024 17:56
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()));`.
@Nevay Nevay requested a review from a team April 5, 2024 17:06
Copy link

codecov bot commented Apr 5, 2024

Codecov Report

Attention: Patch coverage is 55.07246% with 31 lines in your changes are missing coverage. Please review.

Project coverage is 77.53%. Comparing base (7ec0e90) to head (5ff28f6).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             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     
Flag Coverage Δ
8.1 77.53% <55.07%> (+0.22%) ⬆️
8.2 77.53% <55.07%> (+0.22%) ⬆️
8.3 77.53% <55.07%> (+0.22%) ⬆️
8.4 77.53% <55.07%> (+0.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/Context/Context.php 82.60% <100.00%> (ø)
src/Context/ContextStorage.php 94.73% <100.00%> (+0.61%) ⬆️
src/Context/ContextStorageHead.php 100.00% <100.00%> (ø)
src/Context/ContextStorageNode.php 96.77% <100.00%> (ø)
...ntext/FiberBoundContextStorageExecutionAwareBC.php 100.00% <100.00%> (ø)
src/Context/fiber/initialize_fiber_handler.php 0.00% <0.00%> (ø)
src/Context/ZendObserverFiber.php 0.00% <0.00%> (ø)
src/Context/FiberBoundContextStorage.php 0.00% <0.00%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ec0e90...5ff28f6. Read the comment docs.

@brettmc brettmc merged commit 6cd7a8a into open-telemetry:main Apr 8, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants