Issue workflow progress
Progress of the issue based on the
Contributor Workflow
Describe the bug
When using useOpenTelemetry({ resolvers: true }), resolver spans are created but resolver execution is not run inside an active span context. As a result, nested spans created inside resolvers attach to the GraphQL operation span instead of the resolver span.
To Reproduce Steps to reproduce the behavior:
- Enable
useOpenTelemetry with resolvers: true.
- Execute a GraphQL query whose resolvers call any instrumented library.
- Inspect traces (or run the StackBlitz repro).
Expected behavior
Nested spans created during resolver execution should be children of the resolver span, not the operation span.
Environment:
- OS: macOS (darwin 24.6.0)
- NodeJS: v24.11.1
@envelop/* versions:
@envelop/core: 5.5.0
@envelop/opentelemetry: 9.1.0
@envelop/on-resolve: 7.1.0
Additional context
The resolver span is created in the useOnResolve handler, but the resolver execution itself is not wrapped in an active span context (e.g. context.with(trace.setSpan(...)) / startActiveSpan), so downstream instrumentations don’t see the resolver span as active.
Issue workflow progress
Progress of the issue based on the
Contributor Workflow
minimal reproduction available on
Stackblitz.
@envelop/*packages that you are using.packages/plugins/opentelemetry/test/use-open-telemetry.spec.tsDescribe the bug
When using
useOpenTelemetry({ resolvers: true }), resolver spans are created but resolver execution is not run inside an active span context. As a result, nested spans created inside resolvers attach to the GraphQL operation span instead of the resolver span.To Reproduce Steps to reproduce the behavior:
useOpenTelemetrywithresolvers: true.Expected behavior
Nested spans created during resolver execution should be children of the resolver span, not the operation span.
Environment:
@envelop/*versions:@envelop/core:5.5.0@envelop/opentelemetry:9.1.0@envelop/on-resolve:7.1.0Additional context
The resolver span is created in the
useOnResolvehandler, but the resolver execution itself is not wrapped in an active span context (e.g.context.with(trace.setSpan(...))/startActiveSpan), so downstream instrumentations don’t see the resolver span as active.