Skip to content

Preserve OpenCensus status description when converting to OpenTelemetry#8511

Draft
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/opencensus-shim-status-description
Draft

Preserve OpenCensus status description when converting to OpenTelemetry#8511
thswlsqls wants to merge 1 commit 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 78.77%. Comparing base (824334c) to head (6a91dc3).

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #8511   +/-   ##
=========================================
  Coverage     78.77%   78.77%           
- Complexity     8579     8580    +1     
=========================================
  Files          1009     1009           
  Lines         28993    28997    +4     
  Branches       3599     3600    +1     
=========================================
+ Hits          22839    22843    +4     
  Misses         5311     5311           
  Partials        843      843           

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

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.

OpenCensus shim drops status description when converting to OpenTelemetry

1 participant