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

@opentelemetry/instrumentation-kafkajs

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@opentelemetry/instrumentation-kafkajs

OpenTelemetry instrumentation for `kafkajs` messaging client for Apache Kafka

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is @opentelemetry/instrumentation-kafkajs?

@opentelemetry/instrumentation-kafkajs is an OpenTelemetry instrumentation library for KafkaJS, a popular Kafka client for Node.js. This package allows you to automatically collect and report telemetry data such as traces and metrics from KafkaJS applications, helping you monitor and troubleshoot your Kafka-based systems.

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

Automatic Tracing

This feature automatically captures and reports trace data for KafkaJS operations, such as producing and consuming messages. The code sample shows how to set up the NodeTracerProvider and register the KafkaJsInstrumentation to start collecting telemetry data.

const { NodeTracerProvider } = require('@opentelemetry/node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { KafkaJsInstrumentation } = require('@opentelemetry/instrumentation-kafkajs');

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

registerInstrumentations({
  instrumentations: [
    new KafkaJsInstrumentation(),
  ],
});

Custom Span Attributes

This feature allows you to add custom attributes to spans for more detailed telemetry data. The code sample demonstrates how to configure the KafkaJsInstrumentation with hooks to add custom attributes to spans for both producer and consumer operations.

const { KafkaJsInstrumentation } = require('@opentelemetry/instrumentation-kafkajs');

const instrumentation = new KafkaJsInstrumentation({
  producerHook: (span, topic, message) => {
    span.setAttribute('custom.attribute', 'value');
  },
  consumerHook: (span, topic, message) => {
    span.setAttribute('custom.attribute', 'value');
  }
});

Other packages similar to @opentelemetry/instrumentation-kafkajs

Keywords

FAQs

Package last updated on 18 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