Nodejs GraphQL Field Resolvers

Does the node agent's graphql instrumentation support creating spans for each field resolver, or only for the complete operation?

Thanks!

Currently it only creates a span around the whole operation, but we have discussed the possibility of spans around resolvers too. Is this an important feature for you?

1 Like

It's perhaps more of a concern for developers than for production, but yes @stephenbelanger

I'm in the process now of writing an instrumentation that supports individual field resolvers.

I dug through an application based on apollo-graphql-express as well as some other graphql code and I've found a common function, addResolveFunctionsToSchema that seems like it would catch a lot (all?) use cases I'm interested in, but it is I believe what require-in-the-middle's README describes as a "module-internal file"

  • options.internals Specifies whether onrequire should be called when module-internal files are loaded; defaults to false .

IIUC it's not currently possible in apm-agent-nodejs to specify this option, and it's not passed by default.

Would it be possible to allow this option?

Thanks!

My first implementation is now functional and supports field resolves of all GraphQLObjectType types in a schema.

Unsurprisingly, some queries invoke a lot of field resolvers, particularly if a long list is part of the operation's return graph.

Is there any way to drop spans that only last an insignificant amount of time?

Thanks!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.