Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
zipkin-instrumentation-axiosjs
Advanced tools
Library to instrument the axios HTTP-client to support zipkin.
Adds Zipkin tracing support for the axios JS HTTP client library. It supports all features of axios
.
npm install zipkin-instrumentation-axiosjs --save
You need to use wrapAxios
fucntion to wrap the native axios
instance, and the axios
instance's type/functions/attributes are not affected. As a result, you can use zipkinAxios
the same as axios
For example:
const axios = require('axios');
const wrapAxios = require('zipkin-instrumentation-axiosjs');
const { Tracer, ExplicitContext, ConsoleRecorder } = require('zipkin');
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';
const zipkinAxios = wrapAxios(axios, { tracer, serviceName: localServiceName, remoteServiceName });
zipkinAxios.get('/user?ID=12345')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
let axiosInstance = axios.create({
baseURL: 'https://some-domain.com/api/',
timeout: 1000,
headers: {'X-Custom-Header': 'foobar'}
});
axiosInstance = wrapAxios(axiosInstance, {
tracer,
serviceName: localServiceName,
remoteServiceName
});
You can intercept requests or responses before they are handled by then or catch.
// Add a request interceptor
axios.interceptors.request.use(function (config) {
// Do something before request is sent
return config;
}, function (error) {
// Do something with request error
return Promise.reject(error);
});
// Add a response interceptor
axios.interceptors.response.use(function (response) {
// Do something with response data
return response;
}, function (error) {
// Do something with response error
return Promise.reject(error);
});
axios instrumentation - integration test
✓ should add headers to requests
✓ should support request shorthand (defaults to GET)
✓ should support both url and uri options
✓ should support promise callback
✓ should report 404 when path does not exist
✓ should report when service does not exist (41ms)
✓ should report when service returns 400
✓ should report when service returns 500
FAQs
Library to instrument the axios HTTP-client to support zipkin.
The npm package zipkin-instrumentation-axiosjs receives a total of 299 weekly downloads. As such, zipkin-instrumentation-axiosjs popularity was classified as not popular.
We found that zipkin-instrumentation-axiosjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.