Skip to content

Concurrent traces#674

Closed
brettmc wants to merge 14 commits into
open-telemetry:mainfrom
brettmc:concurrent-context
Closed

Concurrent traces#674
brettmc wants to merge 14 commits into
open-telemetry:mainfrom
brettmc:concurrent-context

Conversation

@brettmc

@brettmc brettmc commented May 9, 2022

Copy link
Copy Markdown
Contributor

To allow concurrent traces to be generated without clobbering each other, introduce the concept of "default storage", and allow the span builder to accept a storage via setStorage().
If users wish to use non-default storage, they will be responsible for creating that storage, and keeping a reference to it (for example, in a psr-7 request attribute), and then passing that storage on when creating future spans.

Fixes: #671

brettmc added 8 commits May 3, 2022 17:51
in order to allow a single php process to generate multiple traces that do not clobber
each other, I've modified the existing static ContextStorage to be "default storage", ie
the storage that will be used if you don't say otherwise.
SpanBuilder can now accept a storage, and will use that storage to hold the context for
the span. This required propagating storage to several places, so we'll see how that is
received during review.
Also added some tests (still without assertions) and an example which shows that it works,
at least in that one scenario.
There are still a bunch of broken tests to be fixed up.
@codecov

codecov Bot commented May 10, 2022

Copy link
Copy Markdown

Codecov Report

Merging #674 (7e99e2f) into main (85282b5) will decrease coverage by 0.00%.
The diff coverage is 40.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #674      +/-   ##
============================================
- Coverage     86.07%   86.06%   -0.01%     
- Complexity     1151     1163      +12     
============================================
  Files           128      128              
  Lines          2794     2828      +34     
============================================
+ Hits           2405     2434      +29     
- Misses          389      394       +5     
Flag Coverage Δ
7.4 85.98% <40.00%> (-0.05%) ⬇️
8.0 86.06% <40.00%> (-0.01%) ⬇️
8.1 86.06% <40.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
src/API/Trace/AbstractSpan.php 0.00% <0.00%> (-38.89%) ⬇️
src/API/Trace/NoopSpanBuilder.php 92.00% <0.00%> (-8.00%) ⬇️
src/API/Trace/NoopTracer.php 0.00% <0.00%> (ø)
src/Context/ContextStorage.php 0.00% <0.00%> (ø)
src/Context/FiberNotSupportedContextStorage.php 0.00% <0.00%> (ø)
src/Context/ZendObserverFiber.php 0.00% <0.00%> (ø)
src/SDK/Trace/Tracer.php 100.00% <ø> (ø)
src/SDK/Trace/SpanBuilder.php 48.23% <57.14%> (+48.23%) ⬆️
src/Context/Context.php 81.25% <94.73%> (-1.68%) ⬇️
src/API/Trace/NonRecordingSpan.php 100.00% <100.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

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

@brettmc
brettmc marked this pull request as ready for review May 12, 2022 01:09
@brettmc brettmc changed the title Concurrent context Concurrent traces May 12, 2022
@brettmc
brettmc marked this pull request as draft May 13, 2022 12:29
@brettmc

brettmc commented May 13, 2022

Copy link
Copy Markdown
Contributor Author

Converting back to draft while Nevay explores a more elegant solution which might replace this PR.

@Nevay Nevay mentioned this pull request May 14, 2022
@brettmc

brettmc commented May 19, 2022

Copy link
Copy Markdown
Contributor Author

closing, replaced by #675

@brettmc brettmc closed this May 19, 2022
@brettmc
brettmc deleted the concurrent-context branch October 25, 2022 06:56
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.

tracing with async php runtimes

2 participants