@google-cloud/opentelemetry-cloud-trace-propagator
v0.20.0
Published
OpenTelemetry propagation package for Google Cloud Trace format
Downloads
370,334
Readme
OpenTelemetry Google Cloud Trace Propagator
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
- For more information on OpenTelemetry, visit: https://opentelemetry.io/
- For more about OpenTelemetry JavaScript: https://github.com/open-telemetry/opentelemetry-js
- Learn more about Google Cloud Trace at https://cloud.google.com/trace