zipkin-instrumentation-connect

0.22.0 • Public • Published

zipkin-instrumentation-connect

npm

A Connect middleware and instrumentation that adds Zipkin tracing to the application. Compatible with any server which uses the connect api (Express and Restify).

Usage

Connect

const connect = require('connect');
const {Tracer, ExplicitContext, ConsoleRecorder} = require('zipkin');
const zipkinMiddleware = require('zipkin-instrumentation-connect');
 
const ctxImpl = new ExplicitContext();
const recorder = new ConsoleRecorder();
const localServiceName = 'service-a'; // name of this application
const tracer = new Tracer({ctxImpl, recorder, localServiceName});
 
const app = connect();
 
// Add the Zipkin middleware
app.use(zipkinMiddleware({tracer}));

Express

const express = require('express');
const {Tracer, ExplicitContext, ConsoleRecorder} = require('zipkin');
const zipkinMiddleware = require('zipkin-instrumentation-connect');
 
const ctxImpl = new ExplicitContext();
const recorder = new ConsoleRecorder();
const localServiceName = 'service-a'; // name of this application
const tracer = new Tracer({ctxImpl, recorder, localServiceName});
 
const app = express();
 
// Add the Zipkin middleware
app.use(zipkinMiddleware({tracer}));

Restify

const restify = require('restify');
const {Tracer, ExplicitContext, ConsoleRecorder} = require('zipkin');
const zipkinMiddleware = require('zipkin-instrumentation-connect');
 
const ctxImpl = new ExplicitContext();
const recorder = new ConsoleRecorder();
const localServiceName = 'service-a'; // name of this application
const tracer = new Tracer({ctxImpl, recorder, localServiceName});
 
const app = restify.createServer();
 
// Add the Zipkin middleware
app.use(zipkinMiddleware({tracer}));

Readme

Keywords

none

Package Sidebar

Install

npm i zipkin-instrumentation-connect

Weekly Downloads

45

Version

0.22.0

License

Apache-2.0

Unpacked Size

20.2 kB

Total Files

8

Last publish

Collaborators

  • openzipkin