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.5.1 to 0.6.0

lib/index.js

10

package.json
{
"name": "zipkin-instrumentation-fetch",
"version": "0.5.1",
"version": "0.6.0",
"description": "Interceptor for HTTP clients using the 'fetch' API",
"main": "index.js",
"main": "lib/index.js",
"scripts": {
"test": "node ../../node_modules/mocha/bin/mocha --require ../../test/helper.js"
"build": "../../node_modules/.bin/babel src -d lib",
"test": "node ../../node_modules/mocha/bin/mocha --require ../../test/helper.js",
"prepublish": "npm run build"
},

@@ -15,4 +17,4 @@ "author": "OpenZipkin <openzipkin.alt@gmail.com>",

"node-fetch": "^1.5.1",
"zipkin": "^0.5.1"
"zipkin": "^0.6.0"
}
}

1

README.md

@@ -11,3 +11,2 @@ # zipkin-instrumentation-fetch

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

@@ -14,0 +13,0 @@

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

const {HttpHeaders, Annotation} = require('zipkin');
const {Annotation, Request} = require('zipkin');
function getHeaders(traceId, opts) {
const headers = opts.headers || {};
headers[HttpHeaders.TraceId] = traceId.traceId;
headers[HttpHeaders.SpanId] = traceId.spanId;
traceId._parentId.ifPresent(psid => {
headers[HttpHeaders.ParentSpanId] = psid;
});
traceId.sampled.ifPresent(sampled => {
headers[HttpHeaders.Sampled] = sampled ? '1' : '0';
});
return headers;
}
function wrapFetch(fetch, {tracer, serviceName = 'unknown', remoteServiceName}) {

@@ -37,5 +22,3 @@ return function zipkinfetch(url, opts = {}) {

const headers = getHeaders(traceId, opts);
const zipkinOpts = Object.assign({}, opts, {headers});
const zipkinOpts = Request.addZipkinHeaders(opts, traceId);
fetch(url, zipkinOpts).then(res => {

@@ -42,0 +25,0 @@ tracer.scoped(() => {

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