> For the complete documentation index, see [llms.txt](https://totalsoft.gitbook.io/graphql-rocket-generator/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://totalsoft.gitbook.io/graphql-rocket-generator/built-in-architecture/tracing.md).

# Tracing

Micro-service Architecture has now become the obvious choice for application developers, but how can you debug and monitor a set of interdependent distributed services? Here comes OpenTelemetry to help us.&#x20;

GraphQL Rocket Generator, includes an OpenTelemetry integration using **Jaeger**, helping you to monitor all the components of your GraphQL server ( SQL, Knex statements, GraphQL request life-cycle both Http and WebSocket and of course traces requests and events handled in your messaging handlers.

This feature includes tracing setup code found in `src/startup/tracing`, and tracing middleware you can find in :

* `src/middleware/tracing`,&#x20;
* `src/messaging/middleware/tracing`,&#x20;
* `src/pubsub/middleware/tracingPublish`&#x20;
* `src/subscriptions/middleware/tracing`

In addition, to activate this option, you will need to make a few configuration in server's `.env` file:

```
OTEL_SERVICE_NAME=<%= projectName %>
OTEL_TRACING_ENABLED=true
OTEL_TRACE_PROXY=false
```

### Testing tracing locally

Prerequisites:

* [Docker desktop](https://docs.docker.com/desktop/install/windows-install/)
* Run [Jaeger All-in-one](https://www.jaegertracing.io/docs/1.62/getting-started/#all-in-one)

```bash
docker run --rm --name jaeger \
  -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
  -p 6831:6831/udp \
  -p 6832:6832/udp \
  -p 5778:5778 \
  -p 16686:16686 \
  -p 4317:4317 \
  -p 4318:4318 \
  -p 14250:14250 \
  -p 14268:14268 \
  -p 14269:14269 \
  -p 9411:9411 \
  jaegertracing/all-in-one:1.62.0
```

* Make sure your services are configured to use your collector on port `4317`, or the one specified in [Jaeger All-in-one](https://www.jaegertracing.io/docs/1.62/getting-started/#all-in-one)

```
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
```

* Access Jaeger Frontend, at e.g.: `http://localhost:16686/`
