Skip to content

Support generator functions in startSpan APIs #10772

Not planned
Not planned
@mydea

Description

@mydea
Member

Today, we do not support providing generator functions as a callback to startSpan or startSpanManual.

This is fundamentally a bit tricky, first because it is a bit tricky (but probably possible?) to detect if a generator function has been provided as a callback. But more fundamentally, when using this in node, execution context handling will not work as expected inside of the generator function (which is a known node issue).

Still it's not unreasonable to want to use something like this:

function*() {
  yield startSpan({ name: 'my span' }, function*() {
    yield waitForSomeTask();
   });
}

We should find some way to support this, either inside of startSpan or through a dedicated helper like startSpanGenerator (naming is hard, but you get the point...).

Activity

AbhiPrasad

AbhiPrasad commented on Feb 21, 2024

@AbhiPrasad
Member
added this to the 8.0.0 milestone on Feb 23, 2024
modified the milestones: 8.0.0, 9.0.0 on Jun 4, 2024
removed this from the 9.0.0 milestone on Nov 13, 2024
mydea

mydea commented on Dec 11, 2024

@mydea
MemberAuthor

I am closing this because we are not really planning any work on this for now.

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

        Participants

        @mydea@lforst@AbhiPrasad

        Issue actions

          Support generator functions in `startSpan` APIs · Issue #10772 · getsentry/sentry-javascript