Skip to content

Conversation

@jerrytfleung
Copy link
Contributor

This PR is to implement onEnding interface of Span Processor in Trace SDK.

Changes:

  • Added an experimental ExtendedSpanProcessor interface to declare onEnding
  • Changed MultiSpanProcessor to implement ExtendedSpanProcessor instead and added onEnding implementation
  • Added the calling of onEnding interface at Span::end() function
  • Updated unit test cases to include the testing of ExtendedSpanProcessor

@jerrytfleung jerrytfleung requested a review from a team as a code owner November 21, 2025 23:22
@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.49%. Comparing base (709db46) to head (1da4478).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1785      +/-   ##
============================================
- Coverage     68.49%   68.49%   -0.01%     
- Complexity     2970     2974       +4     
============================================
  Files           448      448              
  Lines          8714     8720       +6     
============================================
+ Hits           5969     5973       +4     
- Misses         2745     2747       +2     
Flag Coverage Δ
8.1 68.10% <100.00%> (+<0.01%) ⬆️
8.2 68.39% <100.00%> (-0.05%) ⬇️
8.3 68.32% <100.00%> (+<0.01%) ⬆️
8.4 68.41% <100.00%> (+0.10%) ⬆️
8.5 68.34% <100.00%> (+0.05%) ⬆️

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

Files with missing lines Coverage Δ
src/SDK/Trace/Span.php 93.37% <100.00%> (+0.08%) ⬆️
src/SDK/Trace/SpanProcessor/MultiSpanProcessor.php 100.00% <100.00%> (ø)

... and 5 files 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 709db46...1da4478. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.


$this->endEpochNanos = $endEpochNanos ?? Clock::getDefault()->now();
if ($this->spanProcessor instanceof ExtendedSpanProcessorInterface) {
$this->spanProcessor->onEnding($this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Must prevent modifications from outside of the ::onEnding() callbacks.

Should backport the 2.x Span::end() implementation #1483 if we want to add this to 1.x.

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