Socket
Socket
Sign inDemoInstall

zipkin-instrumentation-axios

Package Overview
Dependencies
15
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    zipkin-instrumentation-axios

Wrapper to instrument the axios HTTP-client


Version published
Weekly downloads
184
decreased by-44.74%
Maintainers
1
Install size
1.20 MB
Created
Weekly downloads
 

Readme

Source

zipkin-instrumentation-axios

Library to instrument the axios HTTP-client.

You need to inject you axios instance into wrapAxios(axios, options).

Installation

npm install --save zipkin-instrumentation-axios

Usage

// Require dependencies
const axios = require('axios');
const wrapAxios = require('zipkin-instrumentation-axios');
const { Tracer, ExplicitContext, BatchRecorder } = require('zipkin');

// Setup zipkin components
const ctxImpl = new ExplicitContext();
const recorder = new BatchRecorder({
  logger: new HttpLogger({
    endpoint: `http://localhost:9411/api/v1/spans`
  })
});
const tracer = new Tracer({ ctxImpl, recorder });

// Wrapp an instance of axios
const zipkinAxios = wrapAxios(axios, { tracer, serviceName: 'myService'});

// Fetch data with HTTP-GET
zipkinAxios.get('http://another-service/foo')
.then(result => res.send(result.data))
.catch(e => console.log(e));

// Post data
zipkinAxios.post('http://another-service/bar', { bar: 42 })
.then(result => res.send(result.data))
.catch(e => console.log(e));

Keywords

FAQs

Last updated on 14 Mar 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc