Apply Trace Context headers to your Apollo Client requests
Via npm
npm install apollo-link-trace
Via Yarn
yarn add apollo-link-trace
TraceContextLink
accepts an options
object that allows you to pass options when creating the link.
tracestate
- Default tracestate
header to use for requests. This can be overridden via individual call contexts.
import { ApolloClient, HttpLink, InMemoryCache, from } from '@apollo/client'
import { TraceContextLink } from 'apollo-link-trace'
const apolloClient = new ApolloClient({
link: from([
new TraceContextLink(),
new HttpLink({
uri: graphqlEndpoint,
})
]),
cache: new InMemoryCache(),
});