A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1686 below:

pkg:instrumentation-graphql ignoreTrivialResolveSpans doesn't work · Issue #1686 · open-telemetry/opentelemetry-js-contrib · GitHub

What version of OpenTelemetry are you using?
     "@opentelemetry/api": "^1.4.1"
What version of Node are you using? 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:

https://github.com/apollographql/apollo-server/blob/f6e3ae021417c3b54200f8d3fcf4366dc3518998/packages/server/src/utils/schemaInstrumentation.ts#L57-L101

For that reason, this condition:

if (field.resolve) { field.resolve = wrapFieldResolver(tracer, getConfig, field.resolve); }

evaluates true for all resolvers (including the default ones) and always ends up instrumenting all field resolvers

zanemcca, bmbferreira, klippx, Manivela and marco2216


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4