hemera-zipkin

6.0.5 • Public • Published

Hemera-zipkin package

npm styled with prettier

This is a plugin to use Zipkin with Hemera.

Tracking level

  1. Per subscription: Each topic represents a subscription in NATS and therefore handled as own service. The hemera tag indentifiy the server instance.
  2. Per hemera instance: Each hemera instance represents the whole service. The service name can be configured by the tag option.

Install

npm i hemera-zipkin --save

Getting started

Run zipkin in docker

$ docker-compose up

You can then navigate to http://localhost:9411 to access the Zipkin UI.

Usage

const hemera = new Hemera(nats, {
  logLevel: 'debug',
  childLogger: true,
  tag: 'user-service'
})
 
hemera.use(hemeraZipkin, {
  debug: false,
  host: '127.0.0.1',
  port: '9411',
  path: '/api/v1/spans',
  subscriptionBased: true, // when false the hemera tag represents the service otherwise the NATS topic name
  sampling: 1
})

Add contextual data

Look in the documentation to learn more about delegate in hemera.

hemera.add(
  {
    topic: 'profile',
    cmd: 'get'
  },
  function(req, cb) {
    this.delegate$.query = 'SELECT FROM User;'
    cb(null, true)
  }
)

Advanced example

here

/hemera-zipkin/

    Package Sidebar

    Install

    npm i hemera-zipkin

    Weekly Downloads

    44

    Version

    6.0.5

    License

    MIT

    Unpacked Size

    28.7 kB

    Total Files

    9

    Last publish

    Collaborators

    • starptech