Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@opentelemetry/instrumentation-undici

Package Overview
Dependencies
Maintainers
3
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/instrumentation-undici

OpenTelemetry instrumentation for `undici` http client and Node.js fetch()

  • 0.7.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
773K
decreased by-50.84%
Maintainers
3
Weekly downloads
 
Created

What is @opentelemetry/instrumentation-undici?

@opentelemetry/instrumentation-undici is an npm package that provides automatic instrumentation for the undici HTTP client library using OpenTelemetry. This allows developers to collect and export telemetry data such as traces and metrics from their undici-based HTTP requests, which can be used for monitoring and observability purposes.

What are @opentelemetry/instrumentation-undici's main functionalities?

Automatic Instrumentation

This feature allows you to automatically instrument undici HTTP client requests. By registering the UndiciInstrumentation with the OpenTelemetry tracer provider, all HTTP requests made using undici will be traced and the telemetry data will be collected.

const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { UndiciInstrumentation } = require('@opentelemetry/instrumentation-undici');

const provider = new NodeTracerProvider();
provider.register();

registerInstrumentations({
  instrumentations: [
    new UndiciInstrumentation(),
  ],
  tracerProvider: provider,
});

Custom Attributes

This feature allows you to add custom attributes to the spans created for undici HTTP requests. By providing a requestHook function, you can modify the span and add any custom attributes you need for better observability.

const { UndiciInstrumentation } = require('@opentelemetry/instrumentation-undici');

const undiciInstrumentation = new UndiciInstrumentation({
  requestHook: (span, request) => {
    span.setAttribute('custom-attribute', 'value');
  },
});

Other packages similar to @opentelemetry/instrumentation-undici

Keywords

FAQs

Package last updated on 07 Nov 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc