Skip to content

Isolate nonfatal failures in span processor callbacks - #9022

Merged
jack-berg merged 3 commits into
open-telemetry:mainfrom
ultramancode:fix/span-onending-exception
Dec 1, 2026
Merged

jack-berg merged 3 commits into
open-telemetry:mainfrom
ultramancode:fix/span-onending-exception

Conversation

@ultramancode

@ultramancode ultramancode commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #9021

Log nonfatal failures from onStart, onEnding, and onEnd so they don't propagate to application code. A nonfatal failure in one processor no longer prevents the remaining processors from receiving the same callback.

Fatal errors are still rethrown. If onEnding throws a fatal error, the SDK marks the span as ended and clears the ending thread reference before the error reaches the caller.

Added tests for both nonfatal and fatal failures, including a case where the first processor throws a nonfatal exception and the second still receives the callback.

Signed-off-by: Taewoong Kim <ktw2172@gmail.com>
@ultramancode
ultramancode requested a review from a team as a code owner November 8, 2026 15:46
@linux-foundation-easycla

linux-foundation-easycla Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: ultramancode / name: Taewoong Kim (17d85e1)

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-12-01 12:43 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@codecov

codecov Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.53%. Comparing base (f02bddc) to head (7797dc2).
⚠️ Report is 31 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #9022      +/-   ##
============================================
+ Coverage     90.35%   90.53%   +0.18%     
- Complexity    11017    11249     +232     
============================================
  Files          1021     1040      +19     
  Lines         30128    30699     +571     
  Branches       3933     4015      +82     
============================================
+ Hits          27221    27794     +573     
+ Misses         1953     1928      -25     
- Partials        954      977      +23     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@ultramancode

Copy link
Copy Markdown
Contributor Author

@jack-berg
Thanks for the review! I’ll update this PR as suggested.
I’ll also take on both follow-ups and open a separate issue and PR for each.

Signed-off-by: Taewoong Kim <ktw2172@gmail.com>
@ultramancode ultramancode changed the title End span even if ExtendedSpanProcessor.onEnding throws Isolate nonfatal failures in span processor callbacks Nov 26, 2026
@ultramancode

Copy link
Copy Markdown
Contributor Author

@jack-berg

I opened #9067 for the log side and used ThrottlingLogger there to limit repeated warnings. It’s internal to sdk:common, and the OTLP exporters already use it too, so I’d like to move it to an impl package alongside ThrowableUtil in the follow-up.

Signed-off-by: Taewoong Kim <ktw2172@gmail.com>
@jack-berg
jack-berg merged commit 163301f into open-telemetry:main Dec 1, 2026
34 checks passed
@otelbot

otelbot Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Thank you for your contribution @ultramancode! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey.

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.

Exception from ExtendedSpanProcessor.onEnding escapes Span.end() and drops the span

2 participants