Skip to content

Add links to OpenCensus spans after span start#8635

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

Add links to OpenCensus spans after span start#8635
thswlsqls wants to merge 1 commit into
open-telemetry:mainfrom
thswlsqls:fix/opencensus-shim-add-link

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Fixes #6589

Description

  • OpenTelemetrySpanImpl.addLink(Link) logged a warning and dropped the link. It now converts the
    OpenCensus link and forwards it to the OpenTelemetry span.
  • The warning ("OpenTelemetry does not support links added after a span is created") predates
    Span#addLink, added in 1.37.0, so its premise no longer holds.
  • Siblings addAnnotation and addMessageEvent already delegate; addLink was the only one that
    did not.
  • Calls getDelegate().addLink(..), not DelegatingSpan.super.addLink(..), which would resolve to
    the no-op default method on Span.
  • Link.getType() is dropped — no OpenTelemetry equivalent, and OpenTelemetrySpanBuilderImpl
    ignores link type too.
  • Removes the stale "Known Problems" README section; the dropped links bullet was its only entry.

Testing done

  • Added OpenTelemetrySpanImplTest#addLink_delegatesToOtelSpan and #addLink_mapsAttributes,
    asserting trace ID, span ID and attributes reach Span#addLink(SpanContext, Attributes). Both
    fail without the fix.
  • ./gradlew :opencensus-shim:check — 63 tests passed.
  • No public API change, so no apidiff update; added a ### Shims CHANGELOG entry.

@thswlsqls
thswlsqls force-pushed the fix/opencensus-shim-add-link branch from a6d909e to 0982385 Compare July 17, 2026 06:27
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.65%. Comparing base (09d6c17) to head (e6f64e9).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #8635      +/-   ##
============================================
+ Coverage     91.64%   91.65%   +0.01%     
- Complexity    10348    10349       +1     
============================================
  Files          1013     1013              
  Lines         27380    27389       +9     
  Branches       3218     3218              
============================================
+ Hits          25092    25103      +11     
+ Misses         1558     1556       -2     
  Partials        730      730              

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

@thswlsqls
thswlsqls force-pushed the fix/opencensus-shim-add-link branch from 0982385 to e6f64e9 Compare July 18, 2026 01:00
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.

AddLink support for OpenCensusSpanImpl

1 participant