Skip to content

senecajs-labs/seneca-zipkin-tracer

Repository files navigation

Seneca

seneca-zipkin-tracer

npm version Build Status Coverage Status Dependency Status Gitter chat

  • Sponsor: nearForm
  • Node: 4.x, 6.x
  • Seneca: 3.3

This plugin sends traces about actions execution to a zipkin tracing system instance.

Both local and remote call are traced. Zipkin will receive the action pattern as the method name and the seneca tag as the serviceName.

If you're using this module, and need help, you can:

If you are new to Seneca in general, please take a look at senecajs.org. We have everything from tutorials to sample apps to help get you up and running quickly.

Install

npm install seneca-zipkin-tracer

Usage

You will need a running instance of zipkin (best way in dev is with docker).

Apart from that, usage is quite simple: just register the plugin and you're ready to trace.

var server = Seneca({tag: 'service-name'}).use('zipkin-tracer')

Location of zipkin can be configured through options:

var server = Seneca({tag: 'service-name'}).use('zipkin-tracer', {
  host: '127.0.0.1',
  port: 9411,
  url: '/api/v1/spans'
})

Assuming you have installed zipkin with the docker container linked above, you can reach the zipkin dashboard at http://localhost:9411/ where you should find all the traces collected for your service.

Options

The plugin accepts the same options of zipkin-simple:

  • host: location of zipkin server
  • port: port of the zipkin http transport
  • url: path where to send traces
  • transport: which transport to use (http, http-simple or custom function)
  • sampling: the sampling ratio, from 0 to 1 (0 means don't send data, 1 send all data)
  • for the http transport, batchSize and batchTimeout control the batching of spans and traces

Caveats

Currently only supports zipkin http transport

Test

To run tests locally,

npm run test

To obtain a coverage report,

npm run coverage; open docs/coverage.html

Contributing

The Senecajs org encourage open participation. If you feel you can help in any way, be it with documentation, examples, extra testing, or new features please get in touch.

License

Copyright (c) 2013 - 2016, Richard Rodger and other contributors. Licensed under MIT.