Skip to content

parentSpanIsAlwaysRootSpan disables options.parentSpan #16769

Closed
@nighca

Description

@nighca

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

9.31.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

  1. Init sentry (browser) as decribed in the doc. The parentSpanIsAlwaysRootSpan will be set true by default, see details here.

  2. In application code, start a span with specific parent span (by options.parentSpan). For example:

    const parentSpan = { /** Some existed span */ }
    const childSpan = Sentry.startInactiveSpan({ parentSpan })
    childSpan.end()

Expected Result

We expect the childSpan to use parentSpan as its parent.

Actual Result

The childSpan uses the root span as its parent.

I think it's a bug because if the user do specify some parentSpan, it means he is clear about the hierarchy structure here and is intended to construct a parent-child relationship. The parentSpanIsAlwaysRootSpan, which I expect to act as a global default behavior, makes it impossible.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions