OpenCensus Zipkin Exporter for Node.js
OpenCensus Zipkin Exporter allows the user to send collected traces with OpenCensus Node.js to Zipkin.
This project is still at an early stage of development. It's subject to change.
Installation
Install OpenCensus Zipkin Exporter with:
npm install @deal/opencensus-nodejs
npm install @deal/opencensus-exporter-zipkin
Usage
To use Zipkin as your exporter, first, download from any of the three available options on Quickstart: through Docker, on Java or manually compiling the source code. Tests were executed running Zipkin with Java, through the following commands on terminal:
wget -O zipkin.jar 'https://search.maven.org/remote_content?g=io.zipkin.java&a=zipkin-server&v=LATEST&c=exec'
java -jar zipkin.jar
Instance the exporter on your application and pass the options, it must contain a service name and, optionaly, an URL. If no URL is passed, http://localhost:9411/api/v2/spans
is used as default.
For javascript:
var tracing = require('@deal/opencensus-nodejs');
var zipkin = require('@deal/opencensus-exporter-zipkin');
// Add your zipkin url (ex http://localhost:9411/api/v2/spans)
// and application name to the Zipkin options
var options = {
url: 'your-zipkin-url',
serviceName: 'your-application-name'
}
var exporter = new zipkin.ZipkinTraceExporter(options);
Similarly for Typescript:
import * as tracing from '@deal/opencensus-nodejs';
import { Zipkin } from '@deal/opencensus-exporter-zipkin';
// Add your zipkin url (ex http://localhost:9411/api/v2/spans)
// and application name to the Zipkin options
const options = {
url: 'your-zipkin-url',
serviceName: 'your-application-name'
}
const exporter = new Zipkin(options);
Now, register the exporter and start tracing.
tracing.start({'exporter': exporter});
or
tracing.registerExporter(exporter).start();
Useful links
- For more information on OpenCensus, visit: https://opencensus.io/
- To checkout the OpenCensus for Node.js, visit: https://github.com/census-instrumentation/opencensus-node
- For help or feedback on this project, join us on gitter