Skip to content

Support span links for auto-instrumented network spans on Android #6168

Description

@sentry-junior

Problem Statement

An Android application using Kotlin needs to associate an auto-instrumented network span with other relevant operations while retaining one parent.

A simplified illustration of the requested workflow:

  1. Operation A supplies the current context for network span parenting.
  2. Operation B is also running outside that context.
  3. A network request creates span N under A.
  4. The requester wants to link N to B as well, potentially across traces.

The requester described bindToScope in their mobile setup and asked for both Cocoa and Android support. They have not supplied the Android networking integration or context-management code. This is not a verified Android bug reproduction.

  • Choosing one parent leaves other overlapping operations out of the debugging context.
  • The requester thinks viewing and following links in Trace View may be sufficient. Navigation direction and a need for search, filtering, or aggregation remain unconfirmed.
  • No workaround for the additional relationships has been reported. A rollout blocker and quantified debugging cost have not been established.
  • A seven-day telemetry sample observed sentry.java.android 8.53.0 and 8.47.0 on September 24, 2026. These are deployed versions, not verified minimum affected versions. Kotlin Multiplatform is not confirmed and is outside this request's scope.

Solution Brainstorm

Provide a supported way to add links to auto-instrumented network spans without replacing their parent or duplicating the span.

  • OpenTelemetry's span-link documentation describes links to one or more spans as causal relationships. The requester asked to link all active spans but welcomes guidance. Time overlap alone does not establish causality, so automatic linking to every active span is not a requirement.
  • Sentry's span-link development guidance describes links at span creation and an addLink method on the span interface. Links identify the target trace and span. This is the proposed model, not evidence that Android implements these APIs.
  • Assess which API or instrumentation hook would let application code attach links to automatically created network spans. The desired result is to inspect and follow those relationships in Trace View. Cross-trace behavior and navigation direction need assessment.

If better parent selection or a view of concurrent operations fits the need better, guidance on that alternative would help.

Related Cocoa request: sentry-cocoa #9165.

via ben.davis.

--

View Junior Session [Sentry]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions