Skip to content
This repository has been archived by the owner on Mar 19, 2022. It is now read-only.

Latest commit

 

History

History
 
 

zipkin-instrumentation-hapi

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

zipkin-instrumentation-hapi

A hapi middleware that adds Zipkin tracing to the application.

Usage

const Hapi = require('hapi');
const {Tracer, ExplicitContext, ConsoleRecorder} = require('zipkin');
const zipkinMiddleware = require('zipkin-instrumentation-hapi').hapiMiddleware;

const ctxImpl = new ExplicitContext();
const recorder = new ConsoleRecorder();

const tracer = new Tracer({ctxImpl, recorder}); // configure your tracer properly here

const server = new Hapi.Server();

// Add the Zipkin middleware
server.register({
  register: zipkinMiddleware,
  options: {
    tracer,
    serviceName: 'service-a' // name of this application
  }
});