Envelop is a lightweight library allowing developers to easily develop, share, collaborate and extend their GraphQL execution layer. Envelop is the missing GraphQL plugin system.
Is your feature request related to a problem? Please describe.
The getActiveSpan() function always returns undefined when used in a GraphQL resolver.
This issue arises because @envelop/sentry does not execute the GraphQL resolver within the callback of startSpan.
This means that it's not possible to generate child spans for the spans created by @envelop/sentry.
For example, @pothos/tracing-sentry uses getActiveSpan(), but since it can't retrieve an active span, it fails to perform tracing properly.
Describe the solution you'd like
For the sake of simplification, some implementations will be omitted, but it is necessary to execute the GraphQL resolver using setExecuteFn within the callback of startSpan as shown below.
Is your feature request related to a problem? Please describe.
The
getActiveSpan()
function always returns undefined when used in a GraphQL resolver. This issue arises because@envelop/sentry
does not execute the GraphQL resolver within the callback ofstartSpan
.This means that it's not possible to generate child spans for the spans created by
@envelop/sentry
. For example,@pothos/tracing-sentry
uses getActiveSpan(), but since it can't retrieve an active span, it fails to perform tracing properly.Describe the solution you'd like
For the sake of simplification, some implementations will be omitted, but it is necessary to execute the GraphQL resolver using
setExecuteFn
within the callback of startSpan as shown below.This is the correct way to handle
startSpan
as described in Sentry's documentation.