Skip to content

Preserve OpenCensus status description when converting to OpenTelemetry#8511

Merged
jack-berg merged 2 commits into
open-telemetry:mainfrom
thswlsqls:fix/opencensus-shim-status-description
Jul 13, 2026
Merged

Preserve OpenCensus status description when converting to OpenTelemetry#8511
jack-berg merged 2 commits into
open-telemetry:mainfrom
thswlsqls:fix/opencensus-shim-status-description

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Fixes #8508

Description

  • OpenTelemetrySpanImpl.setStatus(io.opencensus.trace.Status) mapped only the status code (OK/ERROR) and dropped the OpenCensus status description, so Status.UNKNOWN.withDescription("connection refused") reached exporters as an ERROR with no description.
  • Now read status.getDescription() and forward it through the existing setStatus(StatusCode, String) delegation — the sibling overload that already carries a description to the OpenTelemetry span — falling back to the code-only overload when the description is null.
  • No description branch is needed for OK: SdkSpan.setStatus ignores a description when the status is not ERROR.

Testing done

  • Added OpenTelemetrySpanImplTest#setStatus_preservesDescription (description forwarded as setStatus(ERROR, "...")) and #setStatus_withoutDescription_setsCodeOnly (no description delegates the code-only overload).
  • ./gradlew :opencensus-shim:check — passed (new test class: 2 tests).
  • Added a ## Unreleased entry in CHANGELOG.md (status description is now visible in exported span status).

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.61%. Comparing base (c5c9d87) to head (9385e33).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8511      +/-   ##
============================================
+ Coverage     91.60%   91.61%   +0.01%     
- Complexity    10312    10315       +3     
============================================
  Files          1013     1013              
  Lines         27274    27278       +4     
  Branches       3202     3203       +1     
============================================
+ Hits          24983    24990       +7     
+ Misses         1563     1562       -1     
+ Partials        728      726       -2     

☔ 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.

@jack-berg jack-berg added the needs author feedback Waiting for additional feedback from the author label Jul 2, 2026
@jack-berg
jack-berg marked this pull request as ready for review July 13, 2026 20:28
@jack-berg
jack-berg requested a review from a team as a code owner July 13, 2026 20:28
@jack-berg
jack-berg merged commit e81496c into open-telemetry:main Jul 13, 2026
29 checks passed
@otelbot

otelbot Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

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

@thswlsqls
thswlsqls deleted the fix/opencensus-shim-status-description branch July 17, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs author feedback Waiting for additional feedback from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCensus shim drops status description when converting to OpenTelemetry

2 participants