@aspecto/opentelemetry-plugin-kafka-node
v0.0.72
Published
open telemetry instrumentation for the `kafka-node` kafka client
Downloads
102
Keywords
Readme
OpenTelemetry kafka-node Instrumentation for Node.js
This module provides automatic instrumentation for kafka-node
.
Installation
npm install --save @aspecto/opentelemetry-plugin-kafka-node
Usage
To load a specific plugin (kafka-node in this case), specify it in the Node Tracer's configuration
const { NodeTracerProvider } = require('@opentelemetry/node');
const provider = new NodeTracerProvider({
plugins: {
'kafka-node': {
enabled: true,
// You may use a package name or absolute path to the file.
path: '@aspecto/opentelemetry-plugin-kafka-node',
}
}
});
kafka-node Plugin Options
kafka-node plugin has few options available to choose from. You can set the following:
| Options | Type | Description |
| ------- | ---- | ----------- |
| producerHook
| KafkaProducerCustomAttributeFunction
| Hook called before producer message is sent, which allow to add custom attributes to span. |
| consumerHook
| KafkaConsumerCustomAttributeFunction
| Hook called before consumer message is processed, which allow to add custom attributes to span. |
Known Issues
- This library instrument only the
Producer
andConsumer
. - Due to the lack of support in kafka-node in message headers, there is currently no context propagation between producers and consumers.