OpenCensus Trace Context Format Propagation for Node.js
OpenCensus Trace Context Format Propagation sends a span context on the wire in an HTTP request, allowing other services to create spans with the right context.
The library is in alpha stage and the API is subject to change.
Installation
Install OpenCensus TraceContex Propagation with:
npm install @opencensus/propagation-tracecontext
Usage
To propagate span context arround services with Trace Context Propagation, pass an instance of Trace Context Propagation to your tracing instance. For Javascript:
const tracing = require('@opencensus/nodejs');
const propagation = require('@opencensus/propagation-tracecontext');
const traceContext = new propagation.TraceContextFormat();
tracing.start({propagation: traceContext});
Similarly for Typescript:
import * as tracing from '@opencensus/nodejs';
import { TraceContextFormat } from '@opencensus/propagation-tracecontext';
const traceContext = new TraceContextFormat();
tracing.start({propagation: traceContext});
Useful links
- To know more about Trace Context Format propagation, visit: https://w3c.github.io/distributed-tracing/
- For more information on OpenCensus, visit: https://opencensus.io/
- To checkout the OpenCensus for Node.js, visit: https://github.com/census-instrumentation/opencensus-node
- For help or feedback on this project, join us on gitter