0.0.1 • Published 7 years ago

koa-middleware-zipkin v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

koa-middleware-zipkin

Koa middleware and instrumentation that adds Zipkin tracing to the application.

Install

$ npm install --save koa-middleware-zipkin

API

middleware(info)

info

tracer

Type: zipkin.Tracer or false Default: false

serviceName

Type: string Default: unknown

port

Type: number Default: 0

Examples

Typeorm DB Connection Proxy

This library will wrap grpc client proxy to record traces.

import * as Koa from 'koa';
import * as KoaInstrumentation from "../index";
import * as zipkin from 'zipkin';

const tracer = new zipkin.Tracer({
    ctxImpl: new zipkin.ExplicitContext(),
    recorder: new zipkin.ConsoleRecorder()
});

const app = new Koa();

// Add the Zipkin middleware
app.use(KoaInstrumentation.middleware({tracer}));