Skip to content

Latest commit

 

History

History
43 lines (33 loc) · 1.71 KB

File metadata and controls

43 lines (33 loc) · 1.71 KB

OpenTelemetry Google Cloud Trace Propagator

NPM Published Version Apache License

OpenTelemetry Google Cloud Trace Propagator allows other services to create spans with the right context.

Format: TRACE_ID/SPAN_ID;o=TRACE_TRUE

  • {TRACE_ID}

    • is a 32-character hexadecimal value representing a 128-bit number.
    • It should be unique between your requests, unless you intentionally want to bundle the requests together.
  • {SPAN_ID}

    • is the decimal representation of the (unsigned) span ID.
    • It should be randomly generated and unique in your trace.
    • For subsequent requests, set SPAN_ID to the span ID of the parent request.
  • {TRACE_TRUE}

    • must be 1 to trace request. Specify 0 to not trace the request.

Usage

const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { CloudPropagator } = require('@google-cloud/opentelemetry-cloud-trace-propagator');

const provider = new NodeTracerProvider();
provider.register({
  // Use CloudPropagator
  propagator: new CloudPropagator()
});

Useful links