Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zipkin-instrumentation-fetch

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zipkin-instrumentation-fetch - npm Package Compare versions

Comparing version 0.16.0 to 0.16.1

3

lib/wrapFetch.js

@@ -15,6 +15,7 @@ "use strict";

});
return function zipkinfetch(url) {
return function zipkinfetch(input) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return new Promise(function (resolve, reject) {
tracer.scoped(function () {
var url = typeof input === 'string' ? input : input.url;
var method = opts.method || 'GET';

@@ -21,0 +22,0 @@ var zipkinOpts = instrumentation.recordRequest(opts, url, method);

{
"name": "zipkin-instrumentation-fetch",
"version": "0.16.0",
"version": "0.16.1",
"description": "Interceptor for HTTP clients using the 'fetch' API",

@@ -20,5 +20,5 @@ "main": "lib/index.js",

"node-fetch": "^1.5.3",
"zipkin": "^0.16.0"
"zipkin": "^0.16.1"
},
"gitHead": "9e0eee22a07156056656c2eeca8b4f94d5dbed34"
"gitHead": "9be8a88f4f3c33030cb327088453db34b87f9a60"
}

@@ -7,5 +7,6 @@ const {

const instrumentation = new Instrumentation.HttpClient({tracer, serviceName, remoteServiceName});
return function zipkinfetch(url, opts = {}) {
return function zipkinfetch(input, opts = {}) {
return new Promise((resolve, reject) => {
tracer.scoped(() => {
const url = (typeof input === 'string') ? input : input.url;
const method = opts.method || 'GET';

@@ -12,0 +13,0 @@ const zipkinOpts =

@@ -87,3 +87,2 @@ const {Tracer, ExplicitContext, createNoopTracer} = require('zipkin');

it('should not throw when using fetch without options', function(done) {

@@ -102,2 +101,16 @@ const tracer = createNoopTracer();

it('should not throw when using fetch with a request object', function(done) {
const tracer = createNoopTracer();
const fetch = wrapFetch(nodeFetch, {serviceName: 'user-service', tracer});
const path = `http://127.0.0.1:${this.port}/user`;
const request = {url: path};
fetch(request)
.then(res => res.json())
.then(() => {
done();
})
.catch(done);
});
it('should record error', (done) => {

@@ -104,0 +117,0 @@ const record = sinon.spy();

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc