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
@@ -24,3 +24,7 @@
24
24
 
25
25
  - Updated ArvoContract typing mechanism
26
26
 
27
+ ## [1.0.7] - 2024-09-01
28
+
29
+ - Updates to OpenTelemetry functions
30
+
@@ -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 (span) {
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: (currentSpan: Span, ...args: TArgs) => TReturn, thisArg?: ThisParameterType<typeof wrappedFunction>, ...args: TArgs) => TReturn;
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.context.traceparent);
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, newSpan], args, false));
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,
@@ -36,5 +36,5 @@ export type TelemetryContext = {
36
36
  /**
37
37
  * The telemetry headers
38
38
  */
39
- context: TelemetryCarrier;
39
+ carrier: TelemetryCarrier;
40
40
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arvo-core",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "This core package contains all the core classes and components of the Arvo Event Driven System",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {