arvo-core 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -47,11 +47,11 @@ var uuid_1 = require("uuid");
|
|
47
47
|
* );
|
48
48
|
*/
|
49
49
|
var createArvoEvent = function (event, extensions, telemetry) {
|
50
|
-
return (0, OpenTelemetry_1.createOtelSpan)(telemetry || 'ArvoEvent Creation Tracer', 'createArvoEvent', {}, function (
|
50
|
+
return (0, OpenTelemetry_1.createOtelSpan)(telemetry || 'ArvoEvent Creation Tracer', 'createArvoEvent', {}, function (telemetryContext) {
|
51
51
|
if (event.datacontenttype &&
|
52
52
|
event.datacontenttype !== schema_1.ArvoDataContentType) {
|
53
53
|
var warning = (0, utils_1.cleanString)("\n Warning! The provided datacontenttype(=".concat(event.datacontenttype, ")\n is not ArvoEvent compatible (=").concat(schema_1.ArvoDataContentType, "). There may \n be some limited functionality.\n "));
|
54
|
-
(0, OpenTelemetry_1.logToSpan)(span, {
|
54
|
+
(0, OpenTelemetry_1.logToSpan)(telemetryContext.span, {
|
55
55
|
level: 'WARNING',
|
56
56
|
message: warning,
|
57
57
|
});
|
@@ -86,7 +86,7 @@ export declare const exceptionToSpan: (span: Span, level: TelemetryLogLevel, err
|
|
86
86
|
* '12345'
|
87
87
|
* );
|
88
88
|
*/
|
89
|
-
export declare const createOtelSpan: <TArgs extends unknown[], TReturn>(telemetryContext: TelemetryContext | string, spanName: string, spanOptions: SpanOptions | undefined, wrappedFunction: (
|
89
|
+
export declare const createOtelSpan: <TArgs extends unknown[], TReturn>(telemetryContext: TelemetryContext | string, spanName: string, spanOptions: SpanOptions | undefined, wrappedFunction: (telemetryContext: TelemetryContext, ...args: TArgs) => TReturn, thisArg?: ThisParameterType<typeof wrappedFunction>, ...args: TArgs) => TReturn;
|
90
90
|
/**
|
91
91
|
* A constant representing a null or not applicable value in OpenTelemetry context.
|
92
92
|
*/
|
@@ -148,13 +148,17 @@ var createOtelSpan = function (telemetryContext, spanName, spanOptions, wrappedF
|
|
148
148
|
activeTracer = api_1.trace.getTracer(telemetryContext);
|
149
149
|
}
|
150
150
|
else {
|
151
|
-
activeContext = (0, exports.getTelemetryContext)(telemetryContext.
|
151
|
+
activeContext = (0, exports.getTelemetryContext)(telemetryContext.carrier.traceparent);
|
152
152
|
activeTracer = telemetryContext.tracer;
|
153
153
|
}
|
154
154
|
var newSpan = activeTracer.startSpan(spanName, spanOptions, activeContext);
|
155
155
|
try {
|
156
156
|
var result = api_1.context.with(api_1.trace.setSpan(activeContext, newSpan), function () {
|
157
|
-
return wrappedFunction.call.apply(wrappedFunction, __spreadArray([thisArg,
|
157
|
+
return wrappedFunction.call.apply(wrappedFunction, __spreadArray([thisArg, {
|
158
|
+
span: newSpan,
|
159
|
+
tracer: activeTracer,
|
160
|
+
carrier: (0, exports.getTelemetryCarrier)(newSpan, activeContext)
|
161
|
+
}], args, false));
|
158
162
|
});
|
159
163
|
newSpan.setStatus({
|
160
164
|
code: api_1.SpanStatusCode.OK,
|