Comparing version 0.11.2 to 0.12.0
@@ -40,3 +40,3 @@ // TypeScript type definitions | ||
createChildId(): TraceId; | ||
letChildId<V>(callback: (traceId: TraceId) => V): V; | ||
letId<V>(traceId: TraceId, callback: () => V): V; | ||
setId(traceId: TraceId): void; | ||
@@ -43,0 +43,0 @@ recordAnnotation(annotation: IAnnotation): void; |
@@ -71,2 +71,7 @@ 'use strict'; | ||
}, { | ||
key: 'letId', | ||
value: function letId(id, callback) { | ||
return this._ctxImpl.letContext(id, callback); | ||
} | ||
}, { | ||
key: 'createRootId', | ||
@@ -170,13 +175,2 @@ value: function createRootId() { | ||
}, { | ||
key: 'letChildId', | ||
value: function letChildId(callable) { | ||
var _this2 = this; | ||
return this.scoped(function () { | ||
var traceId = _this2.createChildId(); | ||
_this2.setId(traceId); | ||
return callable(traceId); | ||
}); | ||
} | ||
}, { | ||
key: 'setId', | ||
@@ -189,3 +183,3 @@ value: function setId(traceId) { | ||
value: function recordAnnotation(annotation) { | ||
var _this3 = this; | ||
var _this2 = this; | ||
@@ -195,5 +189,5 @@ this.id.sampled.ifPresent(function (sampled) { | ||
if (!sampled) return; | ||
_this3.recorder.record(new Record({ | ||
traceId: _this3.id, | ||
timestamp: now(_this3._startTimestamp, _this3._startTick), | ||
_this2.recorder.record(new Record({ | ||
traceId: _this2.id, | ||
timestamp: now(_this2._startTimestamp, _this2._startTick), | ||
annotation: annotation | ||
@@ -200,0 +194,0 @@ })); |
{ | ||
"name": "zipkin", | ||
"version": "0.11.2", | ||
"version": "0.12.0", | ||
"description": "The core tracer for zipkin.js", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -50,2 +50,6 @@ const {None, Some, fromNullable} = require('../option'); | ||
letId(id, callback) { | ||
return this._ctxImpl.letContext(id, callback); | ||
} | ||
createRootId() { | ||
@@ -138,10 +142,2 @@ const rootSpanId = randomTraceId(); | ||
letChildId(callable) { | ||
return this.scoped(() => { | ||
const traceId = this.createChildId(); | ||
this.setId(traceId); | ||
return callable(traceId); | ||
}); | ||
} | ||
setId(traceId) { | ||
@@ -148,0 +144,0 @@ this._ctxImpl.setContext(traceId); |
@@ -43,2 +43,28 @@ const sinon = require('sinon'); | ||
it('should clear scope after letId', () => { | ||
const recorder = { | ||
record: () => {} | ||
}; | ||
const ctxImpl = new ExplicitContext(); | ||
const tracer = new Tracer({ctxImpl, recorder}); | ||
ctxImpl.scoped(() => { | ||
const parentId = tracer.createRootId(); | ||
const childId = tracer.createChildId(); | ||
tracer.setId(parentId); | ||
tracer.letId(childId, () => { | ||
expect(tracer.id).to.equal(childId); | ||
tracer.letId(parentId, () => { | ||
expect(tracer.id).to.equal(parentId); | ||
}); | ||
expect(tracer.id).to.equal(childId); | ||
}); | ||
expect(tracer.id).to.equal(parentId); | ||
}); | ||
}); | ||
it('should make a local span', () => { | ||
@@ -45,0 +71,0 @@ const record = sinon.spy(); |
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
176125
5109