Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@opentelemetry/propagator-b3
Advanced tools
OpenTelemetry B3 propagator provides context propagation for systems that are using the B3 header format
The @opentelemetry/propagator-b3 npm package is used for B3 propagation format which is a convention for passing trace context information across service boundaries. It supports both single-header and multi-header encoding. This package is part of the OpenTelemetry project which provides a collection of tools, APIs, and SDKs to instrument, generate, collect, and export telemetry data (metrics, logs, and traces) to help analyze a software's performance and behavior.
B3 Propagation
This feature allows the user to extract and inject B3 propagation headers. The B3Propagator can be set as the global propagator in OpenTelemetry.
const { B3Propagator } = require('@opentelemetry/propagator-b3');
const { propagation } = require('@opentelemetry/api');
// Use the B3Propagator for extracting and injecting
propagation.setGlobalPropagator(new B3Propagator());
B3 Multi-header Propagation
This feature supports the B3 multi-header propagation format, which uses multiple headers to transmit tracing information. It is useful when interacting with systems that expect B3 headers in multiple header format.
const { B3MultiPropagator } = require('@opentelemetry/propagator-b3');
const { propagation } = require('@opentelemetry/api');
// Use the B3MultiPropagator for extracting and injecting with multi-header support
propagation.setGlobalPropagator(new B3MultiPropagator());
This package is a Node.js client for Jaeger, a distributed tracing system. It includes Jaeger Tracer which can report tracing information to a Jaeger agent or collector. Jaeger and B3 are both tracing propagation formats, but Jaeger is specific to the Jaeger tracing system, whereas B3 is a more general format used by systems like Zipkin.
The Zipkin npm package is a library that interfaces with the Zipkin API for distributed tracing. Similar to B3, Zipkin uses B3 propagation headers for tracing across service boundaries. The Zipkin package provides more comprehensive features for interacting with Zipkin, while @opentelemetry/propagator-b3 focuses on the propagation aspect within the OpenTelemetry ecosystem.
LightStep's tracer library for Node.js is designed to monitor the performance of distributed systems. It uses its own propagation format and is part of the LightStep ecosystem, which is a different distributed tracing solution compared to the B3 propagation used by @opentelemetry/propagator-b3.
The OpenTelemetry b3 propagator package provides multiple propagator implementations for systems using the b3 context format. See the b3 specification for complete details.
Single-Header Format:
b3: {TraceId}-{SpanId}-{SamplingState}-{ParentSpanId}
Multi-Header Format:
X-B3-TraceId: {TraceId}
X-B3-SpanId: {SpanId}
X-B3-ParentSpanId: {ParentSpanId}
X-B3-Sampled: {SamplingState}
{TraceId}
{SpanId}
{ParentSpanId}
{SamplingState} - Single-header
{SamplingState} - Multi-header
{Flags} - Multi-header
X-B3-Flags
: 1. Absent or any other value can be ignored. Debug implies an accept decision, so don't also send the X-B3-Sampled
header.The default B3Propagator
implements b3 propagation according to the
OpenTelemetry specification. It extracts b3 context
from multi and single header encodings and injects context using the
single-header b3 encoding. The inject encoding can be changed to multi-header
via configuration.
Example usage (default):
const api = require('@opentelemetry/api');
const { B3Propagator } = require('@opentelemetry/propagator-b3');
api.propagation.setGlobalPropagator(new B3Propagator());
Example usage (specify inject encoding):
const api = require('@opentelemetry/api');
const { B3Propagator } = require('@opentelemetry/propagator-b3');
api.propagation.setGlobalPropagator(
new B3Propagator({ injectEncoding: B3InjectEncoding.MULTI_HEADER })
);
If a distributed system only needs support for the b3 single-header
encoding it can use the B3SinglePropagator
directly.
Example usage:
const api = require('@opentelemetry/api');
const { B3SinglePropagator } = require('@opentelemetry/propagator-b3');
api.propagation.setGlobalPropagator(new B3SinglePropagator());
If a distributed system only needs support for the b3 multi-header
encoding it can use the B3MultiPropagator
directly.
Example usage:
const api = require('@opentelemetry/api');
const { B3MultiPropagator } = require('@opentelemetry/propagator-b3');
api.propagation.setGlobalPropagator(new B3MultiPropagator());
If a distributed system needs to support both single and multiple header
encodings for inject and extract the B3SinglePropagator
and
B3MultiPropagator
can be used in conjunction with a CompositePropagator
.
Example usage:
const api = require('@opentelemetry/api');
const { CompositePropagator } = require('@opentelemetry/core');
const {
B3SinglePropagator,
B3MultiPropagator,
} = require('@opentelemetry/propagator-b3');
api.propagation.setGlobalPropagator(
new CompositePropagator({
propagators: [new B3SinglePropagator(), new B3MultiPropagator()],
})
);
Apache 2.0 - See LICENSE for more information.
FAQs
OpenTelemetry B3 propagator provides context propagation for systems that are using the B3 header format
The npm package @opentelemetry/propagator-b3 receives a total of 2,140,774 weekly downloads. As such, @opentelemetry/propagator-b3 popularity was classified as popular.
We found that @opentelemetry/propagator-b3 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.