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

0.2.0 • Public • Published

@uphold/opentelemetry-baggage-span-processor

Package that sets all baggage entries as span attributes.

Installation

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

Why?

Finding spans or traces that match contextual data stored in baggage is not an out-of-the-box feature in OpenTelemetry. This packages sets all baggage entries as span attributes so that you can search any span based on data stored in the baggage, like a user.id or request.id.

Usage

Add BaggageSpanProcessor as a spanProcessor to the tracerProvider. Here's how it looks if you are using the NodeSDK:

import { BaggageSpanProcessor } from '@uphold/opentelemetry-baggage-span-processor';
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
import { ProxyTracerProvider, trace } from '@opentelemetry/api';

const sdk = new NodeSDK({});

sdk.start();

const proxyTracerProvider = trace.getTracerProvider() as ProxyTracerProvider;
const tracerProvider = proxyTracerProvider.getDelegate() as NodeTracerProvider;

tracerProvider.addSpanProcessor(new BaggageSpanProcessor());

Tests

npm test

License

Licensed under MIT.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    501
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.0
    501
  • 0.1.1
    310
  • 0.1.0
    1,853
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i @uphold/opentelemetry-baggage-span-processor

Weekly Downloads

2,664

Version

0.2.0

License

MIT

Unpacked Size

6.71 kB

Total Files

11

Last publish

Collaborators

  • fixe
  • ruimarinho
  • botatuphold