https://github.com/ryanhefner/apollo-link-trace
Apollo Link that applies Trace Context headers to your Apollo Client requests.
https://github.com/ryanhefner/apollo-link-trace
apollo apollo-link distributed-tracing opentelemetry trace trace-context
Last synced: 3 months ago
JSON representation
Apollo Link that applies Trace Context headers to your Apollo Client requests.
- Host: GitHub
- URL: https://github.com/ryanhefner/apollo-link-trace
- Owner: ryanhefner
- License: mit
- Created: 2024-09-05T20:50:57.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-09-06T04:39:33.000Z (9 months ago)
- Last Synced: 2025-02-17T09:06:31.945Z (3 months ago)
- Topics: apollo, apollo-link, distributed-tracing, opentelemetry, trace, trace-context
- Language: JavaScript
- Homepage: https://www.pkgstats.com/pkg:apollo-link-trace
- Size: 34.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# apollo-link-trace
[](https://www.pkgstats.com/pkg:apollo-link-trace)
[](LICENSE)
[](https://www.pkgstats.com/pkg:apollo-link-trace)
Apply Trace Context headers to your Apollo Client requests
## Install
Via [npm](https://npmjs.com/package/apollo-link-trace)
```sh
npm install apollo-link-trace
```Via [Yarn](https://yarn.pm/apollo-link-trace)
```sh
yarn add apollo-link-trace
```## How to use
`TraceContextLink` accepts an `options` object that allows you to pass options when creating the link.
### Options
`tracestate` - Default `tracestate` header to use for requests. This can be overridden via individual call contexts.
## Example
```
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(),
});
```## License
[MIT](LICENSE) © [Ryan Hefner](https://www.ryanhefner.com)