Skip to content

Commit

Permalink
docs(graphql-instrumentation): add documentation for ignoreResolveSpa…
Browse files Browse the repository at this point in the history
…ns (#1912)
  • Loading branch information
satazor authored Jan 31, 2024
1 parent 497a3c3 commit 84e1a6b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/node/opentelemetry-instrumentation-graphql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ registerInstrumentations({
// depth: 2,
// mergeItems: true,
// ignoreTrivialResolveSpans: true,
// ignoreResolveSpans: true,
}),
],
});
Expand All @@ -57,6 +58,7 @@ registerInstrumentations({
| depth | number | -1 | The maximum depth of fields/resolvers to instrument. When set to 0 it will not instrument fields and resolvers. When set to -1 it will instrument all fields and resolvers. | |
| allowValues | boolean | false | When set to true it will not remove attributes values from schema source. By default all values that can be sensitive are removed and replaced with "*" | |
| ignoreTrivialResolveSpans | boolean | false | Don't create spans for the execution of the default resolver on object properties. |
| ignoreResolveSpans | boolean | false | Don't create spans for resolvers, regardless if they are trivial or not. |
| responseHook | GraphQLInstrumentationExecutionResponseHook | undefined | Hook that allows adding custom span attributes based on the data returned from "execute" GraphQL action. | |

## Verbosity
Expand All @@ -73,6 +75,13 @@ They are all disabled by default. User can opt in to any combination of them to

When a resolver function is not defined on the schema for a field, graphql will use the default resolver which just looks for a property with that name on the object. If the property is not a function, it's not very interesting to trace.

### ignoreResolveSpans

The performance overhead for complex schemas with a lot of resolvers can be high due to the large number of spans created. When ignoreResolveSpans is set to true, no spans for resolvers will be created.

If you are using `@apollo/server` as your graphql server, you might want to
enable this option because all resolvers are [currently considered non-trivial](https://github.com/open-telemetry/opentelemetry-js-contrib/issues/1686).

### depth

The depth is the number of nesting levels of the field, and the following is a query with a depth of 3:
Expand Down

0 comments on commit 84e1a6b

Please sign in to comment.