Repository navigation
fix(sdk): record the latest error status whatever its description - #3867
Open
WatchTree-19 wants to merge 4 commits into
Open
WatchTree-19 wants to merge 4 commits into
WatchTree-19 wants to merge 4 commits into
Conversation
Span::set_status compared statuses with the derived PartialOrd, which orders two Error values by their description. A later error therefore replaced an earlier one only when its description sorted after it, so "timeout" followed by "connection refused" kept "timeout". Ok stays final and Unset is still ignored; otherwise the latest status is recorded, as the Status docs describe.
Pull request dashboard statusWaiting on maintainers · refreshed 2026-12-04 15:18 UTC Merge when ready. Status above doesn't look right?
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3867 +/- ##
=======================================
- Coverage 86.8% 86.8% -0.1%
=======================================
Files 131 131
Lines 34801 34809 +8
=======================================
+ Hits 30216 30222 +6
- Misses 4585 4587 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
TommyCpp
reviewed
Nov 16, 2026
TommyCpp
left a comment
Contributor
There was a problem hiding this comment.
LGTM. We should probably update this doc comment too:
opentelemetry-rust/opentelemetry/src/global/trace.rs
Lines 67 to 70 in 07e323c
Author
Author
|
@lalitb thanks for the approval. Is there anything else needed from me before this can be merged? |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Span::set_statusinopentelemetry-sdk/src/trace/span.rsupdates the status only whenstatus > data.status.StatusderivesPartialOrd, and a derived ordering compares twoErrorvalues by theirdescription, so a later error replaces an earlier one only when its description sorts after it:The
Statusdocs say only the value of the last call is recorded. This keepsOkfinal and ignoresUnset, as the specification requires, and otherwise records the latest status. The other SDKs (Java, JS, Ruby, PHP) behave the same way.Two cases are added to the existing
set_statustest: a later error with an earlier-sorting description is recorded, andUnsetdoes not clear an error. The first fails on main withleft: Error { description: "timeout" }.Merge requirement checklist
CHANGELOG.mdfiles updated for non-trivial, user-facing changesChecked with
cargo fmt --all,cargo clippy -p opentelemetry_sdk --all-targets --all-features -- -Dwarningsandcargo test -p opentelemetry_sdk --all-features --lib(513 passed).