0.22.0 • Published 4 years ago

zipkin-instrumentation-kafkajs v0.22.0

Weekly downloads
13
License
Apache-2.0
Repository
github
Last release
4 years ago

zipkin-instrumentation-kafkajs

Zipkin instrumentation for KafkaJS producer and consumer.

Requirements

The solution uses kafka message headers to propagate tracing context and as such requires Kafka version 0.11+

Limitations

Currently only single message handling is traced, batch message handling is not yet supported. This means you need to use the consumer's eachMessage method for consuming messages and the producer's send method.

Error reporting is supported but you need to make sure your consumer or producer does not infinitely retry (perhaps pauses the consumer for a while) when exception is encountered otherwise you will keep receiving new error spans.

Usage

const instrumentKafkaJs = require('zipkin-instrument-kafkajs');

const kafka = instrumentKafkaJs(new Kafka({
  clientId: 'my-app',
  brokers: ['localhost:9092']
}), {
    tracer, //Your zipkin tracer instance
    remoteServiceName : 'node-backend' //When using producer, the remote endpoint
});

//Use KafkaJS as usual, single message handling will use tracing
const consumer = kafka.consumer({ groupId: 'test-group' });
consumer.connect();
consumer.subscribe({ topic: 'hello' });
consumer.run({
  eachMessage: async ({ topic, partition, message }) => {
    console.log(message.value.toString());
  }
});

const producer = kafka.producer();
producer.connect();
producer.send({
  topic: 'topic-name',
  messages: [{ key: 'key1', value: 'hello world' }]
});
0.22.1-alpha.6

4 years ago

0.22.1-alpha.3

5 years ago

0.22.0

5 years ago

0.21.0

5 years ago

0.20.0

5 years ago

0.19.2-alpha.6

5 years ago

0.19.2

5 years ago

0.19.2-alpha.3

5 years ago

0.19.2-alpha.1

6 years ago

0.19.1

6 years ago

0.20.0-alpha.1

6 years ago

0.20.0-alpha.0

6 years ago

0.19.0

6 years ago

0.18.6

6 years ago

0.18.5

6 years ago

0.18.4

6 years ago

0.18.4-alpha.7

6 years ago

0.19.0-alpha.4

6 years ago

0.18.3

6 years ago

0.18.2

6 years ago

0.18.1

6 years ago

0.18.0

6 years ago