OpenTelemetry kafka-node Instrumentation for Node.js
This module provides automatic instrumentation for kafka-node
.
Installation
npm install --save @mzahor-test-org/open-telemetry-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,
path: '@mzahor-test-org/open-telemetry-kafka-node',
}
}
});
kafka-node Plugin Options
kafka-node plugin has few options available to choose from. You can set the following:
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
and Consumer
.
- Due to the lack of support in kafka-node in message headers, there is currently no context propagation between producers and consumers.