Open
Description
What version of OpenTelemetry are you using?
"@opentelemetry/api": "^1.4.1"
What version of Node are you using?
v18.17.1
What did you do?
I enabled the auto instrumentation with ignoreTrivialResolveSpans
option enabled
new GraphQLInstrumentation({
ignoreTrivialResolveSpans: true
})
Expected:
What did you expect to see?
The resolves that don't have any custom implementation don't generate any span
What did you see instead?
All resolves generate a corresponding span
Additional context
Digging into Apollo's implementation, I found that when it loads its internal plugins, it always wraps the field.resolve
with a function that executes the default or the user-defined resolver, as you can see here:
For that reason, this condition:
evaluates true for all resolvers (including the default ones) and always ends up instrumenting all field resolvers