Comparing version 0.11.1 to 0.11.2
@@ -122,3 +122,3 @@ // TypeScript type definitions | ||
class Endpoint { | ||
constructor(args: { serviceName?: string, ipv4?: InetAddress, port?: number }); | ||
constructor(args: { serviceName?: string, ipv4?: string, port?: number }); | ||
@@ -197,2 +197,3 @@ setServiceName(serviceName: string): void; | ||
readonly annotationType: string; | ||
message: string; | ||
} | ||
@@ -203,2 +204,3 @@ | ||
readonly annotationType: string; | ||
serviceName: string; | ||
} | ||
@@ -209,2 +211,3 @@ | ||
readonly annotationType: string; | ||
name: string; | ||
} | ||
@@ -220,2 +223,5 @@ | ||
readonly annotationType: string; | ||
serviceName: string | ||
host: InetAddress; | ||
port: number; | ||
} | ||
@@ -226,2 +232,4 @@ | ||
readonly annotationType: string; | ||
host: InetAddress; | ||
port: number; | ||
} | ||
@@ -232,2 +240,4 @@ | ||
readonly annotationType: string; | ||
key: string; | ||
value: string; | ||
} | ||
@@ -234,0 +244,0 @@ } |
@@ -62,2 +62,9 @@ 'use strict'; | ||
var span = this.partialSpans.get(id); | ||
// TODO(adriancole) refactor so this responsibility isn't in writeSpan | ||
if (span === undefined) { | ||
// Span not found. Could have been expired. | ||
return; | ||
} | ||
// ready for garbage collection | ||
@@ -64,0 +71,0 @@ this.partialSpans.delete(id); |
@@ -17,3 +17,3 @@ 'use strict'; | ||
function stringToBoolean(str) { | ||
return str === '1'; | ||
return str === '1' || str === 'true'; | ||
} | ||
@@ -20,0 +20,0 @@ |
{ | ||
"name": "zipkin", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "The core tracer for zipkin.js", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -43,2 +43,9 @@ const {now, hrtime} = require('./time'); | ||
const span = this.partialSpans.get(id); | ||
// TODO(adriancole) refactor so this responsibility isn't in writeSpan | ||
if (span === undefined) { | ||
// Span not found. Could have been expired. | ||
return; | ||
} | ||
// ready for garbage collection | ||
@@ -45,0 +52,0 @@ this.partialSpans.delete(id); |
@@ -7,3 +7,3 @@ const Header = require('../httpHeaders'); | ||
function stringToBoolean(str) { | ||
return str === '1'; | ||
return str === '1' || str === 'true'; | ||
} | ||
@@ -10,0 +10,0 @@ |
@@ -182,18 +182,28 @@ const sinon = require('sinon'); | ||
const trace = new Tracer({ctxImpl, recorder}); | ||
const traceId = new TraceId({ | ||
traceId: None, | ||
parentId: new Some('a'), | ||
spanId: 'c', | ||
sampled: new Some(true) | ||
}); | ||
ctxImpl.scoped(() => { | ||
trace.setId(new TraceId({ | ||
traceId: None, | ||
parentId: new Some('a'), | ||
spanId: 'c', | ||
sampled: new Some(true) | ||
})); | ||
trace.setId(traceId); | ||
trace.recordServiceName('SmoothieStore'); | ||
trace.recordAnnotation(new Annotation.ServerRecv()); | ||
}); | ||
clock.tick('02'); // polling interval is every second | ||
expect(logSpan.calledOnce).to.equal(false); | ||
clock.tick('02'); // polling interval is every second | ||
expect(logSpan.calledOnce).to.equal(false); | ||
clock.tick('01:00'); // 1 minute is the default timeout | ||
expect(logSpan.calledOnce).to.equal(true); | ||
clock.tick('01:00'); // 1 minute is the default timeout | ||
expect(logSpan.calledOnce).to.equal(true); | ||
ctxImpl.scoped(() => { | ||
trace.setId(traceId); | ||
// ServerSend terminates the span, but it's already expired. | ||
// Span is dropped silently. | ||
trace.recordAnnotation(new Annotation.ServerSend()); | ||
}); | ||
@@ -200,0 +210,0 @@ |
@@ -157,2 +157,25 @@ const sinon = require('sinon'); | ||
}); | ||
it('should tolerate boolean literals for sampled header received from the client', () => { | ||
const record = sinon.spy(); | ||
const recorder = {record}; | ||
const ctxImpl = new ExplicitContext(); | ||
const tracer = new Tracer({recorder, ctxImpl}); | ||
const headers = { | ||
'X-B3-TraceId': 'aaa', | ||
'X-B3-SpanId': 'bbb', | ||
'X-B3-Flags': '1', | ||
'X-B3-Sampled': 'true' | ||
}; | ||
const port = 80; | ||
const url = `http://127.0.0.1:${port}`; | ||
const instrumentation = new HttpServer({tracer, serviceName: 'service-a', port}); | ||
const readHeader = function(name) { return headers[name] ? new Some(headers[name]) : None; }; | ||
ctxImpl.scoped(() => { | ||
const id = instrumentation.recordRequest('POST', url, readHeader); | ||
expect(id._sampled.value).to.equal(true); | ||
}); | ||
}); | ||
}); |
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
175716
5098