zipkin-transport-kafka
TypeScript icon, indicating that this package has built-in type declarations

0.22.0 • Public • Published

zipkin-transport-kafka

npm

This is a module that sends Zipkin trace data from zipkin-js to Kafka.

Usage

npm install zipkin-transport-kafka --save

const {
  Tracer,
  BatchRecorder,
  jsonEncoder: {JSON_V2} 
= require('zipkin');
const {KafkaLogger} = require('zipkin-transport-kafka');
const noop = require('noop-logger');
 
const kafkaRecorder = new BatchRecorder({
  logger: new KafkaLogger({
    clientOpts: {
      connectionString: 'localhost:2181'
    },
    encoder: JSON_V2, // optional (defaults to THRIFT)
    log: noop // optional (defaults to console)
  })
});
 
const tracer = new Tracer({
  recorder,
  ctxImpl, // this would typically be a CLSContext or ExplicitContext
  localServiceName: 'service-a' // name of this application
});

If you do not use zookeeper to store offsets, use clientOpts.kafkaHost instead of clientOpts.connectionString.

const {BatchRecorder} = require('zipkin');
const {KafkaLogger} = require('zipkin-transport-kafka');
 
const kafkaRecorder = new BatchRecorder({
  logger: new KafkaLogger({
    clientOpts: {
      kafkaHost: 'localhost:2181'
    }
  })
});

/zipkin-transport-kafka/

    Package Sidebar

    Install

    npm i zipkin-transport-kafka

    Weekly Downloads

    3,316

    Version

    0.22.0

    License

    Apache-2.0

    Unpacked Size

    27.2 kB

    Total Files

    12

    Last publish

    Collaborators

    • openzipkin