@opentelemetry/shim-opentracing
Advanced tools
Comparing version 0.13.0 to 0.14.0
@@ -10,4 +10,4 @@ import * as api from '@opentelemetry/api'; | ||
private readonly _spanContext; | ||
private _correlationContext; | ||
constructor(spanContext: api.SpanContext, correlationContext: api.CorrelationContext); | ||
private _baggage; | ||
constructor(spanContext: api.SpanContext, baggage: api.Baggage); | ||
/** | ||
@@ -18,5 +18,5 @@ * Returns the underlying {@link types.SpanContext} | ||
/** | ||
* Returns the underlying {@link api.CorrelationContext} | ||
* Returns the underlying {@link api.Baggage} | ||
*/ | ||
getCorrelationContext(): api.CorrelationContext; | ||
getBaggage(): api.Baggage; | ||
/** | ||
@@ -54,3 +54,3 @@ * Returns the trace ID as a string. | ||
private readonly _tracerShim; | ||
constructor(tracerShim: TracerShim, span: api.Span, correlationContext: api.CorrelationContext); | ||
constructor(tracerShim: TracerShim, span: api.Span, baggage: api.Baggage); | ||
/** | ||
@@ -57,0 +57,0 @@ * Returns a reference to the Span's context. |
@@ -60,6 +60,6 @@ "use strict"; | ||
class SpanContextShim extends opentracing.SpanContext { | ||
constructor(spanContext, correlationContext) { | ||
constructor(spanContext, baggage) { | ||
super(); | ||
this._spanContext = spanContext; | ||
this._correlationContext = correlationContext; | ||
this._baggage = baggage; | ||
} | ||
@@ -73,6 +73,6 @@ /** | ||
/** | ||
* Returns the underlying {@link api.CorrelationContext} | ||
* Returns the underlying {@link api.Baggage} | ||
*/ | ||
getCorrelationContext() { | ||
return this._correlationContext; | ||
getBaggage() { | ||
return this._baggage; | ||
} | ||
@@ -93,6 +93,6 @@ /** | ||
var _a; | ||
return (_a = this._correlationContext[key]) === null || _a === void 0 ? void 0 : _a.value; | ||
return (_a = this._baggage[key]) === null || _a === void 0 ? void 0 : _a.value; | ||
} | ||
setBaggageItem(key, value) { | ||
this._correlationContext = Object.assign({}, this._correlationContext, { | ||
this._baggage = Object.assign({}, this._baggage, { | ||
[key]: { value }, | ||
@@ -115,9 +115,9 @@ }); | ||
const span = this._tracer.startSpan(name, translateSpanOptions(options), getContextWithParent(options)); | ||
let correlationContext = {}; | ||
let baggage = {}; | ||
if (options.childOf instanceof SpanShim) { | ||
const shimContext = options.childOf.context(); | ||
correlationContext = shimContext.getCorrelationContext(); | ||
baggage = shimContext.getBaggage(); | ||
} | ||
else if (options.childOf instanceof SpanContextShim) { | ||
correlationContext = options.childOf.getCorrelationContext(); | ||
baggage = options.childOf.getBaggage(); | ||
} | ||
@@ -127,3 +127,3 @@ if (options.tags) { | ||
} | ||
return new SpanShim(this, span, correlationContext); | ||
return new SpanShim(this, span, baggage); | ||
} | ||
@@ -133,3 +133,3 @@ _inject(spanContext, format, carrier) { | ||
const oTelSpanContext = spanContextShim.getSpanContext(); | ||
const oTelSpanCorrelationContext = spanContextShim.getCorrelationContext(); | ||
const oTelSpanBaggage = spanContextShim.getBaggage(); | ||
if (!carrier || typeof carrier !== 'object') | ||
@@ -140,3 +140,3 @@ return; | ||
case opentracing.FORMAT_TEXT_MAP: { | ||
api.propagation.inject(carrier, api.defaultTextMapSetter, core_1.setCorrelationContext(api.setExtractedSpanContext(api.ROOT_CONTEXT, oTelSpanContext), oTelSpanCorrelationContext)); | ||
api.propagation.inject(api.setBaggage(api.setExtractedSpanContext(api.ROOT_CONTEXT, oTelSpanContext), oTelSpanBaggage), carrier); | ||
return; | ||
@@ -156,9 +156,9 @@ } | ||
case opentracing.FORMAT_TEXT_MAP: { | ||
const context = api.propagation.extract(carrier); | ||
const context = api.propagation.extract(api.ROOT_CONTEXT, carrier); | ||
const spanContext = api.getParentSpanContext(context); | ||
const correlationContext = core_1.getCorrelationContext(context); | ||
const baggage = api.getBaggage(context); | ||
if (!spanContext) { | ||
return null; | ||
} | ||
return new SpanContextShim(spanContext, correlationContext || {}); | ||
return new SpanContextShim(spanContext, baggage || {}); | ||
} | ||
@@ -182,6 +182,6 @@ case opentracing.FORMAT_BINARY: { | ||
class SpanShim extends opentracing.Span { | ||
constructor(tracerShim, span, correlationContext) { | ||
constructor(tracerShim, span, baggage) { | ||
super(); | ||
this._span = span; | ||
this._contextShim = new SpanContextShim(span.context(), correlationContext); | ||
this._contextShim = new SpanContextShim(span.context(), baggage); | ||
this._tracerShim = tracerShim; | ||
@@ -188,0 +188,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "0.13.0"; | ||
export declare const VERSION = "0.14.0"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -20,3 +20,3 @@ "use strict"; | ||
// this is autogenerated file, see scripts/version-update.js | ||
exports.VERSION = '0.13.0'; | ||
exports.VERSION = '0.14.0'; | ||
//# sourceMappingURL=version.js.map |
{ | ||
"name": "@opentelemetry/shim-opentracing", | ||
"version": "0.13.0", | ||
"version": "0.14.0", | ||
"description": "OpenTracing to OpenTelemetry shim", | ||
@@ -43,5 +43,5 @@ "main": "build/src/index.js", | ||
"devDependencies": { | ||
"@opentelemetry/tracing": "^0.13.0", | ||
"@types/mocha": "8.0.4", | ||
"@types/node": "14.14.10", | ||
"@opentelemetry/tracing": "^0.14.0", | ||
"@types/mocha": "8.2.0", | ||
"@types/node": "14.14.12", | ||
"codecov": "3.8.1", | ||
@@ -53,3 +53,3 @@ "gts": "2.0.2", | ||
"ts-mocha": "8.0.0", | ||
"ts-node": "9.0.0", | ||
"ts-node": "9.1.1", | ||
"tslint-consistent-codestyle": "1.16.0", | ||
@@ -60,7 +60,7 @@ "tslint-microsoft-contrib": "6.2.0", | ||
"dependencies": { | ||
"@opentelemetry/api": "^0.13.0", | ||
"@opentelemetry/core": "^0.13.0", | ||
"@opentelemetry/api": "^0.14.0", | ||
"@opentelemetry/core": "^0.14.0", | ||
"opentracing": "^0.14.4" | ||
}, | ||
"gitHead": "86cbd6798f9318c5920f9d9055f289a1c3f26500" | ||
"gitHead": "27a8d4530c56257c191468b073669909bf8892a1" | ||
} |
Sorry, the diff of this file is not supported yet
35236
+ Added@opentelemetry/api@0.14.0(transitive)
+ Added@opentelemetry/context-base@0.14.0(transitive)
+ Added@opentelemetry/core@0.14.0(transitive)
- Removed@opentelemetry/api@0.13.0(transitive)
- Removed@opentelemetry/context-base@0.13.0(transitive)
- Removed@opentelemetry/core@0.13.0(transitive)
Updated@opentelemetry/api@^0.14.0
Updated@opentelemetry/core@^0.14.0