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.14.1 to 0.14.2

2

lib/index.js

@@ -0,1 +1,3 @@

'use strict';
module.exports = require('./wrapFetch');

37

lib/wrapFetch.js

@@ -1,21 +0,28 @@

const {
Instrumentation
} = require('zipkin');
'use strict';
function wrapFetch(fetch, { tracer, serviceName, remoteServiceName }) {
const instrumentation = new Instrumentation.HttpClient({ tracer, serviceName, remoteServiceName });
return function zipkinfetch(url, opts = {}) {
return new Promise((resolve, reject) => {
tracer.scoped(() => {
const method = opts.method || 'GET';
const zipkinOpts = instrumentation.recordRequest(opts, url, method);
const traceId = tracer.id;
var _require = require('zipkin'),
Instrumentation = _require.Instrumentation;
fetch(url, zipkinOpts).then(res => {
tracer.scoped(() => {
function wrapFetch(fetch, _ref) {
var tracer = _ref.tracer,
serviceName = _ref.serviceName,
remoteServiceName = _ref.remoteServiceName;
var instrumentation = new Instrumentation.HttpClient({ tracer: tracer, serviceName: serviceName, remoteServiceName: remoteServiceName });
return function zipkinfetch(url) {
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return new Promise(function (resolve, reject) {
tracer.scoped(function () {
var method = opts.method || 'GET';
var zipkinOpts = instrumentation.recordRequest(opts, url, method);
var traceId = tracer.id;
fetch(url, zipkinOpts).then(function (res) {
tracer.scoped(function () {
instrumentation.recordResponse(traceId, res.status);
});
resolve(res);
}).catch(err => {
tracer.scoped(() => {
}).catch(function (err) {
tracer.scoped(function () {
instrumentation.recordError(traceId, err);

@@ -22,0 +29,0 @@ });

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

@@ -19,4 +19,4 @@ "main": "lib/index.js",

"node-fetch": "^1.5.3",
"zipkin": "^0.14.1"
"zipkin": "^0.14.2"
}
}
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