This is a library for instrumenting Node.js applications. It uses a lot of new JavaScript features and syntax, so Node.js version 6 or newer is required.
npm install zipkin --save
Various Node.js libraries have been instrumented with Zipkin support. Every instrumentation has an npm package called zipkin-instrumentation-*.
At the time of writing, zipkin-js instruments these libraries:
- cujojs/rest (zipkin-instrumentation-cujojs-rest)
- express (zipkin-instrumentation-express)
- fetch (zipkin-instrumentation-fetch)
- hapi (zipkin-instrumentation-hapi)
- memcached (zipkin-instrumentation-memcached)
- redis (zipkin-instrumentation-redis)
- restify (zipkin-instrumentation-restify)
Every module has a README.md file that describes how to use it.
You can choose between multiple transports; they are npm packages called zipkin-transport-*.
Currently, the following transports are available:
Every package has its own README.md which describes how to use it.
Zipkin timestamps are microsecond, not millisecond granularity. When running in node.js, process.hrtime is used to achieve this.
In browsers, microsecond precision requires installing a shim like browser-process-hrtime:
// use higher-precision time than milliseconds
process.hrtime = require('browser-process-hrtime');
The code base is a monorepo. We use Lerna for managing inter-module
dependencies, which makes it easier to develop coordinated changes between the modules.
Instead of running lerna directly, the commands are wrapped with npm; npm run lerna-bootstrap
and npm run lerna-publish
.
To setup the development environment, run:
npm install
npm run lerna-bootstrap
Running tests: npm test
Note that the memcached integration test requires you to have a local memcached instance running. The Kafka integration test will start an embedded Kafka server for the test, which requires you to have Java installed on your machine.
Running code style linting: npm run lint
AppVeyor is currently broken and ignored. PR welcome from those with Windows boxes.
If you are a user waiting for a merged feature to get released, nag us on the related pull request or gitter.
The actual publish process is easy: Log in to npm with the "OpenZipkin" user. Then, run npm run lerna-publish
.