Helper library for Open Telemetry instrumentation and distributed tracing in Apollo Federation using Apollo Gateway and Apollo Server.
See Apollo Federation Open Telemetry Docs for details on Open Telemetry support in Apollo Federation.
See apollographql/supergraph-demo for a working demo using this library:
See working example in the apollographql/supergraph-demo.
Add this before you even import apollo-server
, express
, or http
.
Otherwise, your trace data will be incomplete.
new ApolloOpenTelemetry({
type: 'router',
name: 'router',
exporter: {
type: 'zipkin', // console, zipkin, collector, ...
host: 'localhost', // default: localhost
port: '9411', // default: exporter specific
}
}).setupInstrumentation();
Apollo Gateway does trace context propagation so the subgraphs in a Apollo Federation can do distributed tracing.
Add this before you even import apollo-server
, express
, or http
.
Otherwise, your trace data will be incomplete.
new ApolloOpenTelemetry({
type: 'subgraph',
name: 'inventory',
exporter: {
type: 'zipkin', // console, zipkin, collector, ...
host: 'localhost', // default: localhost
port: '9411', // default: exporter specific
}
}).setupInstrumentation();