Closed
Description
It is possible today, with the new APIs, to create a span as a child of a specific other span:
const child = Sentry.withActiveSpan(parent, () => Sentry.startInactiveSpan(...));
However, this is not super intuitive for users. We should provide some helper/utility/way to do this easier.
I see two main ways we could do this:
- Create a new method, like
Sentry.startInactiveChildSpan(parent, spanOptions)
- Add an optional
parentSpan
option to allstartSpan*
methods:
Sentry.startSpan({ name: 'xxx', parentSpan: parent }, () => {});
const span = Sentry.startInactiveSpan({ name: 'xxx', parentSpan: parent });
I think I'd tend to the second option, and we should be able to implement this both for core as well as for otel.