opentelemetry-java
opentelemetry-java copied to clipboard
Preserve OpenCensus status description when converting to OpenTelemetry
Fixes #8508
Description
OpenTelemetrySpanImpl.setStatus(io.opencensus.trace.Status)mapped only the status code (OK/ERROR) and dropped the OpenCensus status description, soStatus.UNKNOWN.withDescription("connection refused")reached exporters as anERRORwith no description.- Now read
status.getDescription()and forward it through the existingsetStatus(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.setStatusignores a description when the status is notERROR.
Testing done
- Added
OpenTelemetrySpanImplTest#setStatus_preservesDescription(description forwarded assetStatus(ERROR, "...")) and#setStatus_withoutDescription_setsCodeOnly(no description delegates the code-only overload). ./gradlew :opencensus-shim:check— passed (new test class: 2 tests).- Added a
## Unreleasedentry inCHANGELOG.md(status description is now visible in exported span status).
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 91.61%. Comparing base (c5c9d87) to head (9385e33).
:warning: 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
:umbrella: View full report in Codecov by Harness.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
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.