The OpenTelemetry Propagator for AWS X-Ray provides HTTP header propagation for systems that are using AWS X-Ray HTTP header format. This propagator translates the OpenTelemetry SpanContext into the equivalent AWS X-Ray header format, for use with the OpenTelemetry JS SDK.
npm install --save @aws/otel-aws-xray-propagator
In the global tracer configuration file, configure the following:
const { propagation } = require("@opentelemetry/api");
const { AWSXRayPropagator } = require('@aws/otel-aws-xray-propagator');
// ...
module.exports = ("service_name_here") => {
// set global propagator
propagation.setGlobalPropagator(new AWSXRayPropagator());
// ...}
For more details, see the Getting Started guide.
Example header:X-Amzn-Trace-Id: Root=1-5759e988-bd862e3fe1be46a994272793;Parent=53995c3f42cd8ad8;Sampled=1
The header consists of three parts: the root trace ID, the parent ID and the sampling decision. The root is required, whereas the parent ID and sampling decision are optional.
Root is analogous to the OpenTelemetry Trace ID, with some small format changes. For additional reading, see the AWS X-Ray Trace ID public documentation.
Example of usage (will be added after published):
Apache 2.0 - See LICENSE for more information.
Version | Tag | Published |
---|---|---|
0.13.0 | latest | 2yrs ago |