What is @opentelemetry/propagator-jaeger?
The @opentelemetry/propagator-jaeger npm package is used for propagating trace context using the Jaeger format. This is part of the OpenTelemetry project, which provides a set of APIs, libraries, agents, and instrumentation to create and manage telemetry data (metrics, logs, and traces) for cloud-native software. The Jaeger propagator package specifically deals with the extraction and injection of trace context headers for distributed tracing.
What are @opentelemetry/propagator-jaeger's main functionalities?
Context Propagation
This feature allows the propagation of trace context using the Jaeger format. The code sample demonstrates how to import the JaegerHttpTracePropagator from the package and set it as the global propagator for handling trace context.
{"import { JaegerHttpTracePropagator } from '@opentelemetry/propagator-jaeger';\nimport { propagation } from '@opentelemetry/api';\n\n// Register the Jaeger propagator to handle the trace context\nconst jaegerPropagator = new JaegerHttpTracePropagator();\npropagation.setGlobalPropagator(jaegerPropagator);"}
Other packages similar to @opentelemetry/propagator-jaeger
@opentelemetry/propagator-b3
This package provides B3 propagation for OpenTelemetry. B3 propagation is used by Zipkin tracing. It is similar to the Jaeger propagator in that it handles the injection and extraction of trace context headers for distributed tracing, but it uses the B3 format instead of the Jaeger format.
@opentelemetry/propagator-aws-xray
This package is designed for AWS X-Ray tracing support. It propagates trace context using the AWS X-Ray format. Like the Jaeger propagator, it is used for distributed tracing, but it is specifically tailored to integrate with AWS X-Ray.
@opentelemetry/propagator-ot-trace
The OpenTracing propagator for OpenTelemetry provides context propagation using the OpenTracing format. It is another alternative for distributed tracing context propagation, similar to the Jaeger propagator, but adheres to the OpenTracing standard.
OpenTelemetry Propagator Jaeger
OpenTelemetry Jaeger propagator provides HTTP header propagation for systems that are using Jaeger HTTP header format.
Format:
{trace-id}:{span-id}:{parent-span-id}:{flags}
-
{trace-id}
- 64-bit or 128-bit random number in base16 format.
- Can be variable length, shorter values are 0-padded on the left.
- Value of 0 is invalid.
-
{span-id}
- 64-bit random number in base16 format.
-
{parent-span-id}
- Set to 0 because this field is deprecated.
-
{flags}
- One byte bitmap, as two hex digits.
Example of usage:
const { NodeTracerProvider } = require('@opentelemetry/node');
const { JaegerPropagator } = require('@opentelemetry/propagator-jaeger');
const provider = new NodeTracerProvider();
provider.register({
propagator: new JaegerPropagator()
});
Baggage Notes
Jeager Baggage is represented as multiple headers where the names are carrier dependent. For this reason, they are omitted from the fields
method. This behavior should be taken into account if your application relies on the fields
functionality. See the specification for more details.
Trace on Jaeger UI
Useful links
License
Apache 2.0 - See LICENSE for more information.