@aws/otel-aws-xray-id-generator

AWS X-Ray ID generator for OpenTelemetry

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@aws/otel-aws-xray-id-generator
2880.13.12 years ago2 years agoMinified + gzip package size for @aws/otel-aws-xray-id-generator in KB

Readme

AWS OpenTelemetry X-Ray IdGenerator README
!Gitter chatgitter-imagegitter-url !Apache Licenselicense-imagelicense-image
The OpenTelemetry IdGenerator for AWS X-Ray generates trace IDs with its first four bytes set to the start time of the trace followed by a unique identifier consisting of 12 bytes of randomly generated numbers. OpenTelemetry offers an extension point which allows the usage of this custom IdGenerator as opposed to the out-of-the-box random IdGenerator.

Installation

` npm install --save @aws/otel-aws-xray-id-generator `

Usage

In the global tracer configuration file, configure the following:
const { NodeTracerProvider } = require('@opentelemetry/node');
const { AWSXRayIdGenerator } = require('@aws/otel-aws-xray-id-generator');
// ...

module.exports = ("service_name_here") => {
   const tracerConfig = {
    idGenerator: new AWSXRayIdGenerator(),
    resources: resources
  };
  const tracerProvider = new NodeTracerProvider(tracerConfig);
  // ...}

For more details, see the Getting Started guide.

Trace ID Details

Example trace ID format: 58406520a006649127e371903a2de979
A trace ID consists of two parts; the time stamp and the unique identifier.

Time Stamp

  • the first 8 hexadecimal digits represent the time of the original request in Unix epoch time
  • for example, 10:00AM December 1st, 2016 PST in epoch time is 1480615200 seconds, or 58406520 in hexadecimal digits.

Unique Identifier

  • the last 24 hexadecimal digits is an unique identifier for the trace

Useful links

  • For more information on OpenTelemetry, visit:
  • For more about OpenTelemetry JavaScript:
  • For help or feedback on this project, join us on gittergitter-url

License

Apache 2.0 - See LICENSElicense-url for more information.