The easiest way to add tracing support to your GraphQL service
First of all, install this middleware from your package registry by running the following:
yarn add graphql-middleware-jaeger# or using npmnpm i graphql-middleware-jaeger
After this is done, you can simply add the middleware to your existing service, it could look like the following snippet
The core principle of this package is to stay as unopinionated as possible towards the actual usage, which is why you can configure every aspect, except the run-time behaviour of resolving the middleware.
You can configure the OpenCensus tracer, as well as the Jaeger exporter. For more details, head over to the OpenCensus Node.js repository.
Since there's contextual data that you might want to add to your span, this middleware allows you to define a number of hooks triggered at specific execution points. An example of the usage of hooks is included in the example code above.
Available hooks are: