Skip to content

Latest commit

 

History

History

zipkin-instrumentation-superagent

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

zipkin-instrumentation-superagent

npm

Adds Zipkin tracing to the SuperAgent library.

Usage

The library is a SuperAgent plugin and should be used as:

const request = require('superagent');
const {Tracer, ExplicitContext, ConsoleRecorder} = require('zipkin');
const zipkinPlugin = require('zipkin-instrumentation-superagent');

const ctxImpl = new ExplicitContext();
const recorder = new ConsoleRecorder();
const localServiceName = 'service-a'; // name of this application
const tracer = new Tracer({ctxImpl, recorder, localServiceName});

const remoteServiceName = 'weather-api';
 
request
  .get('http://api.weather.com')
  .use(zipkinPlugin({tracer, remoteServiceName}))
  .end((err, res) => {
    // Do something
  });