Socket
Socket
Sign inDemoInstall

@opentelemetry/propagation-utils

Package Overview
Dependencies
1
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @opentelemetry/propagation-utils

Propagation utilities for opentelemetry instrumentations


Version published
Maintainers
3
Install size
66.8 kB
Created

Readme

Source

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
        }),
    });
}

License

Apache 2.0 - See LICENSE for more information.

Keywords

FAQs

Last updated on 06 Jun 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc