@opentelemetry/propagation-utils
TypeScript icon, indicating that this package has built-in type declarations

0.30.8 • Public • Published

OpenTelemetry Propagation Utils

NPM Published Version Apache License

A collection of propagation utils for opentelemetry.

Install

npm install --save @opentelemetry/propagation-utils

Usage

PubSub

To make sure each message handled by pubsub creates a new process span, and propagates to any internal operation, do as follow:

import { pubsubPropagation } from '@opentelemetry/propagation-utils';
import { Span, propagation, trace, Context } from '@opentelemetry/api';

const patch = (message: Message[], rootSpan: Span) => {
    const tracer = trace.getTracer('my-tracer');
    pubsubPropagation.patchArrayForProcessSpans(messages, tracer);

    pubsubPropagation.patchMessagesArrayToStartProcessSpans<Message>({
        messages,
        tracer,
        parentSpan: rootSpan,
        messageToSpanDetails: (message) => ({
            attributes: { ... },
            name: 'some-name',
            parentContext: propagation.extract(....) as Context
        }),
    });
}

Useful links

License

Apache 2.0 - See LICENSE for more information.

Package Sidebar

Install

npm i @opentelemetry/propagation-utils

Weekly Downloads

529,411

Version

0.30.8

License

Apache-2.0

Unpacked Size

68.4 kB

Total Files

18

Last publish

Collaborators

  • pichlermarc
  • bogdandrutu
  • dyladan