Skip to content

feat: Implement onEnding interface of Span Processor in Trace SDK#1785

Merged
brettmc merged 4 commits into
open-telemetry:mainfrom
jerrytfleung:OnEnding
Nov 25, 2025
Merged

feat: Implement onEnding interface of Span Processor in Trace SDK#1785
brettmc merged 4 commits into
open-telemetry:mainfrom
jerrytfleung:OnEnding

Conversation

@jerrytfleung

Copy link
Copy Markdown
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

codecov Bot commented Nov 21, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.43%. Comparing base (709db46) to head (38a6784).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1785      +/-   ##
============================================
- Coverage     68.49%   68.43%   -0.07%     
- Complexity     2970     2974       +4     
============================================
  Files           448      448              
  Lines          8714     8722       +8     
============================================
  Hits           5969     5969              
- Misses         2745     2753       +8     
Flag Coverage Δ
8.1 68.13% <100.00%> (+0.04%) ⬆️
8.2 68.35% <100.00%> (-0.09%) ⬇️
8.3 68.34% <100.00%> (+0.02%) ⬆️
8.4 68.33% <100.00%> (+0.02%) ⬆️
8.5 67.51% <100.00%> (-0.78%) ⬇️

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.46% <100.00%> (+0.17%) ⬆️
src/SDK/Trace/SpanProcessor/MultiSpanProcessor.php 100.00% <100.00%> (ø)

... and 3 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...38a6784. Read the comment docs.

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

Comment thread src/SDK/Trace/Span.php Outdated

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

Copy link
Copy Markdown
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see.
Done. Backported the related code and test cases from #1483.

@brettmc
brettmc merged commit 7490016 into open-telemetry:main Nov 25, 2025
10 of 11 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