Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 2.11 KB

File metadata and controls

50 lines (38 loc) · 2.11 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.

To get started with instrumentation in Google Cloud, see Generate traces and metrics with Node.js.

To learn more about instrumentation and observability, including opinionated recommendations for Google Cloud Observability, visit Instrumentation and observability.

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