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

zipkin

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zipkin - npm Package Compare versions

Comparing version 0.14.1 to 0.14.2

3

lib/instrumentation/httpClient.js

@@ -57,2 +57,5 @@ 'use strict';

this.tracer.recordBinary('http.status_code', statusCode.toString());
if (statusCode < 200 || statusCode > 399) {
this.tracer.recordBinary('error', statusCode.toString());
}
this.tracer.recordAnnotation(new Annotation.ClientRecv());

@@ -59,0 +62,0 @@ }

@@ -111,2 +111,4 @@ 'use strict';

this.tracer.recordBinary('error', error.toString());
} else if (statusCode < 200 || statusCode > 399) {
this.tracer.recordBinary('error', statusCode.toString());
}

@@ -113,0 +115,0 @@ this.tracer.recordAnnotation(new Annotation.ServerSend());

2

package.json
{
"name": "zipkin",
"version": "0.14.1",
"version": "0.14.2",
"description": "The core tracer for zipkin.js",

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

@@ -42,2 +42,5 @@ const Annotation = require('../annotation');

this.tracer.recordBinary('http.status_code', statusCode.toString());
if (statusCode < 200 || statusCode > 399) {
this.tracer.recordBinary('error', statusCode.toString());
}
this.tracer.recordAnnotation(new Annotation.ClientRecv());

@@ -44,0 +47,0 @@ }

@@ -88,2 +88,4 @@ const Annotation = require('../annotation');

this.tracer.recordBinary('error', error.toString());
} else if (statusCode < 200 || statusCode > 399) {
this.tracer.recordBinary('error', statusCode.toString());
}

@@ -90,0 +92,0 @@ this.tracer.recordAnnotation(new Annotation.ServerSend());

@@ -78,2 +78,30 @@ const sinon = require('sinon');

});
[400, 500].forEach((statusCode) => {
it('should record an error on status code >399', () => {
const record = sinon.spy();
const recorder = {record};
const ctxImpl = new ExplicitContext();
const tracer = new Tracer({ctxImpl, recorder});
const instrumentation = new HttpClient({
tracer,
serviceName: 'weather-app',
remoteServiceName: 'weather-forecast-service'});
const url = 'http://127.0.0.1:80/weather?index=10&count=300';
tracer.scoped(() => {
instrumentation.recordRequest({}, url, 'GET');
instrumentation.recordResponse(tracer.id, statusCode);
});
const annotations = record.args.map(args => args[0]);
const initialTraceId = annotations[0].traceId.traceId;
annotations.forEach(ann => expect(ann.traceId.traceId)
.to.equal(initialTraceId).and
.to.have.lengthOf(16));
expect(annotations[6].annotation.annotationType).to.equal('BinaryAnnotation');
expect(annotations[6].annotation.key).to.equal('error');
expect(annotations[6].annotation.value).to.equal(statusCode.toString());
});
});
});
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