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-fetch

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

zipkin-instrumentation-fetch

This library will wrap the fetch API. You need to provide your own fetch implementation; it could for example come from window.fetch (in the browser), or node-fetch on Node.js.

Usage

const {Tracer} = require('zipkin');
const wrapFetch = require('zipkin-instrumentation-fetch');

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

const nameOfRemoteService = 'youtube';
const zipkinFetch = wrapFetch(fetch, {tracer, remoteServiceName: nameOfRemoteService});

// Your application code here
zipkinFetch('http://www.youtube.com/').then(res => res.json()).then(data => ...);