Socket
Socket
Sign inDemoInstall

opentelemetry-instrumentation-kafkajs

Package Overview
Dependencies
25
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    opentelemetry-instrumentation-kafkajs

open telemetry instrumentation for the `kafkajs` kafka client


Version published
Weekly downloads
88K
decreased by-6.23%
Maintainers
1
Install size
4.48 MB
Created
Weekly downloads
 

Readme

Source

OpenTelemetry kafkajs Instrumentation for Node.js

NPM version

This module provides automatic instrumentation for kafkajs.

Installation

npm install --save opentelemetry-instrumentation-kafkajs

Usage

For further automatic instrumentation instruction see the @opentelemetry/instrumentation package.

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

const tracerProvider = new NodeTracerProvider({
  // be sure to disable old plugin
  plugins: {
    kafkajs: { enabled: false, path: 'opentelemetry-plugin-kafkajs' }
  }
});

registerInstrumentations({
  tracerProvider,
  instrumentations: [
    new KafkaJsInstrumentation({
      // see under for available configuration
    })
  ]
});

kafkajs Instrumentation Options

kafkajs instrumentation has few options available to choose from. You can set the following:

OptionsTypeDescription
producerHookKafkaProducerCustomAttributeFunctionHook called before producer message is sent, which allow to add custom attributes to span.
consumerHookKafkaConsumerCustomAttributeFunctionHook called before consumer message is processed, which allow to add custom attributes to span.
moduleVersionAttributeNamestringIf passed, a span attribute will be added to all spans with key of the provided moduleVersionAttributeName and value of the patched module version

This extension (and many others) was developed by Aspecto with ❤️

Keywords

FAQs

Last updated on 21 May 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