@opentelemetry/baggage-span-processor
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

OpenTelemetry Baggage Span Processor for Node.js

NPM Published Version Apache License

The BaggageSpanProcessor reads entries stored in Baggage from the parent context and adds the baggage entries' keys and values to the span as attributes on span start.

Add this span processor to a tracer provider.

Keys and values added to Baggage will appear on subsequent child spans for a trace within this service and be propagated to external services in accordance with any configured propagation formats configured. If the external services also have a Baggage span processor, the keys and values will appear in those child spans as well.

⚠ Warning ⚠️

Do not put sensitive information in Baggage.

To repeat: a consequence of adding data to Baggage is that the keys and values will appear in all outgoing HTTP headers from the application.

Compatible with OpenTelemetry JS API and SDK 1.0+.

Installation

npm install --save @opentelemetry/baggage-span-processor

Usage

Add to the span processors during configuration:

import { NodeSDK, tracing } from "@opentelemetry/sdk-node";
import { BaggageSpanProcessor } from "@opentelemetry/baggage-span-processor";

const spanProcessors = [
  new tracing.SimpleSpanProcessor(
    new tracing.ConsoleSpanExporter()),
  new BaggageSpanProcessor()];

const sdk = new NodeSDK({
  serviceName: "example-service",
  spanProcessors
});

sdk.start();

Useful links

License

APACHE 2.0 - See LICENSE for more information.

Package Sidebar

Install

npm i @opentelemetry/baggage-span-processor

Weekly Downloads

28

Version

0.2.0

License

Apache-2.0

Unpacked Size

27.3 kB

Total Files

12

Last publish

Collaborators

  • pichlermarc
  • bogdandrutu
  • dyladan