diff --git a/examples/graphql/package.json b/examples/graphql/package.json index e4fa994f3c9..89f8ce9c642 100644 --- a/examples/graphql/package.json +++ b/examples/graphql/package.json @@ -31,12 +31,13 @@ "url": "https://github.com/open-telemetry/opentelemetry-js/issues" }, "dependencies": { + "@opentelemetry/api": "^1.0.1", "@opentelemetry/exporter-collector": "^0.23.0", "@opentelemetry/instrumentation": "^0.23.0", - "@opentelemetry/instrumentation-graphql": "^0.15.0", - "@opentelemetry/node": "^0.23.0", - "@opentelemetry/instrumentation-express": "^0.15.0", + "@opentelemetry/instrumentation-express": "^0.23.0", + "@opentelemetry/instrumentation-graphql": "^0.23.0", "@opentelemetry/instrumentation-http": "^0.23.0", + "@opentelemetry/node": "^0.23.0", "@opentelemetry/tracing": "^0.23.0", "apollo-server": "^2.18.1", "express": "^4.17.1", diff --git a/plugins/node/opentelemetry-instrumentation-graphql/README.md b/plugins/node/opentelemetry-instrumentation-graphql/README.md index 64faacb9bb7..78ac34805f2 100644 --- a/plugins/node/opentelemetry-instrumentation-graphql/README.md +++ b/plugins/node/opentelemetry-instrumentation-graphql/README.md @@ -7,6 +7,10 @@ This module provides *automated instrumentation and tracing* for GraphQL in Node.js applications. +*Note*: graphql plugin instruments graphql directly. it should work with any package that wraps the graphql package (e.g apollo). + +Minimum required graphql version is `v14` + ## Installation ```shell script @@ -38,12 +42,23 @@ registerInstrumentations({ ``` +## Optional Parameters + +| Param | type | Default Value | Description | | +|:-----------:|:-------:|:-------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------:|:-:| +| mergeItems | boolean | false | Whether to merge list items into a single element. example: `users.*.name` instead of `users.0.name`, `users.1.name` | | +| 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 "*" | | +| responseHook | GraphQLInstrumentationExecutionResponseHook | undefined | Hook that allows adding custom span attributes based on the data returned from "execute" GraphQL action. | | + +## Examples +Can be found [here](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/examples/graphql) + ## Useful links - For more information on OpenTelemetry, visit: - For more about OpenTelemetry JavaScript: - For help or feedback on this project, join us in [GitHub Discussions][discussions-url] - ## License Apache 2.0 - See [LICENSE][license-url] for more information.