Skip to main content
Apollo GraphQL is a platform for building GraphQL APIs. Braintrust traces Apollo GraphQL operations across Apollo Server applications and the Apollo Router federation gateway.

Tracing

Braintrust traces Apollo Server operations through an OpenTelemetry pipeline. Install the SDK and dependencies, then attach Braintrust’s span processor and instrument your resolvers.

Setup

Install the Braintrust TypeScript SDK with the OpenTelemetry dependencies, then configure your environment. This integration uses Braintrust’s TypeScript SDK OpenTelemetry configuration.
1

Install packages

Install the Braintrust TypeScript SDK alongside the OpenTelemetry, Apollo Server, and utility dependencies.
2

Set environment variables

.env

OpenTelemetry

Configure a tracer provider with Braintrust’s span processor, then create spans in your resolvers. Add the following to apollo-graphql-braintrust.ts:

Tracing resources

Apollo Router

Apollo Router is a language-neutral federation gateway configured through a YAML file. To trace it, enable its OpenTelemetry exporter and point OTLP at Braintrust. Add the following to apollo-router-braintrust.yaml:
apollo-router-braintrust.yaml

Apollo Router resources