Comparing version 0.14.1 to 0.14.2
@@ -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()); |
{ | ||
"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()); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
343269
4497