arvo-event-handler 2.1.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -27,3 +27,7 @@
27
27
  ## [2.0.0] - 2024-11-26
28
28
 
29
29
  - Added support for versioned contracts in event handler for better versioning support
30
+ ## [2.1.1] - 2024-12-10
31
+
32
+ - Updated the telemetry implementation to be more streamlined, fixed some minor bugs and added better telemetry logging
33
+
@@ -104,7 +104,7 @@ var ArvoEventHandler = /** @class */ (function (_super) {
104
104
  throw new Error("Contract ".concat(_this.contract.uri, " requires handler implementation for version ").concat(contractVersions));
105
105
  }
106
106
  }
107
- _this.spanOptions = __assign(__assign({ kind: api_1.SpanKind.CONSUMER }, param.spanOptions), { attributes: __assign(__assign((_a = {}, _a[arvo_core_1.ArvoExecution.ATTR_SPAN_KIND] = arvo_core_1.ArvoExecutionSpanKind.EVENT_HANDLER, _a[arvo_core_1.OpenInference.ATTR_SPAN_KIND] = arvo_core_1.OpenInferenceSpanKind.CHAIN, _a), ((_c = (_b = param.spanOptions) === null || _b === void 0 ? void 0 : _b.attributes) !== null && _c !== void 0 ? _c : {})), { 'arvo.contract.uri': _this.contract.uri, 'arvo.handler.source': _this.source }) });
107
+ _this.spanOptions = __assign(__assign({ kind: api_1.SpanKind.CONSUMER }, param.spanOptions), { attributes: __assign(__assign((_a = {}, _a[arvo_core_1.ArvoExecution.ATTR_SPAN_KIND] = arvo_core_1.ArvoExecutionSpanKind.EVENT_HANDLER, _a[arvo_core_1.OpenInference.ATTR_SPAN_KIND] = arvo_core_1.OpenInferenceSpanKind.CHAIN, _a), ((_c = (_b = param.spanOptions) === null || _b === void 0 ? void 0 : _b.attributes) !== null && _c !== void 0 ? _c : {})), { 'arvo.handler.source': _this.source, 'arvo.contract.uri': _this.contract.uri }) });
108
108
  return _this;
109
109
  }
110
110
  Object.defineProperty(ArvoEventHandler.prototype, "source", {
@@ -144,134 +144,120 @@ var ArvoEventHandler = /** @class */ (function (_super) {
144
144
  */
145
145
  ArvoEventHandler.prototype.execute = function (event_1) {
146
146
  return __awaiter(this, arguments, void 0, function (event, opentelemetry) {
147
+ var otelConfig;
147
148
  var _this = this;
148
149
  if (opentelemetry === void 0) { opentelemetry = {
149
150
  inheritFrom: 'EVENT',
150
151
  }; }
151
152
  return __generator(this, function (_a) {
152
153
  switch (_a.label) {
153
- case 0: return [4 /*yield*/, arvo_core_1.ArvoOpenTelemetry.getInstance().startActiveSpan({
154
- name: 'ArvoEventHandler',
155
- spanOptions: this.spanOptions,
156
- disableSpanManagement: true,
157
- context: opentelemetry.inheritFrom === 'EVENT'
158
- ? {
159
- inheritFrom: 'TRACE_HEADERS',
160
- traceHeaders: {
161
- traceparent: event.traceparent,
162
- tracestate: event.tracestate,
163
- },
164
- }
165
- : {
166
- inheritFrom: 'CONTEXT',
167
- context: api_1.context.active(),
168
- },
169
- fn: function (span) { return __awaiter(_this, void 0, void 0, function () {
170
- var otelSpanHeaders, parsedDataSchema, handlerContract, inputEventValidation, _handleOutput, outputs, eventFactory_1, result, error_1, eventFactory, result;
171
- var _a, _b, _c, _d;
172
- return __generator(this, function (_e) {
173
- switch (_e.label) {
174
- case 0:
175
- otelSpanHeaders = (0, arvo_core_1.currentOpenTelemetryHeaders)();
176
- _e.label = 1;
177
- case 1:
178
- _e.trys.push([1, 3, 4, 5]);
179
- span.setStatus({ code: api_1.SpanStatusCode.OK });
180
- Object.entries(event.otelAttributes).forEach(function (_a) {
181
- var key = _a[0], value = _a[1];
182
- return span.setAttribute("to_process.0.".concat(key), value);
183
- });
184
- if (this.contract.type !== event.type) {
185
- throw new Error("Event type mismatch: Received '".concat(event.type, "', expected '").concat(this.contract.type, "'"));
186
- }
187
- (0, arvo_core_1.logToSpan)({
188
- level: 'INFO',
189
- message: "Event type '".concat(event.type, "' validated against contract '").concat(this.contract.uri, "'"),
190
- });
191
- parsedDataSchema = arvo_core_1.EventDataschemaUtil.parse(event);
192
- if (!(parsedDataSchema === null || parsedDataSchema === void 0 ? void 0 : parsedDataSchema.version)) {
154
+ case 0:
155
+ otelConfig = (0, utils_1.createEventHandlerTelemetryConfig)('ArvoEventHandler', this.spanOptions, opentelemetry, event);
156
+ return [4 /*yield*/, arvo_core_1.ArvoOpenTelemetry.getInstance().startActiveSpan(__assign(__assign({}, otelConfig), { fn: function (span) { return __awaiter(_this, void 0, void 0, function () {
157
+ var otelSpanHeaders, parsedDataSchema, handlerContract, inputEventValidation, _handleOutput, outputs, eventFactory_1, result, error_1, eventFactory, result;
158
+ var _a, _b, _c, _d;
159
+ return __generator(this, function (_e) {
160
+ switch (_e.label) {
161
+ case 0:
162
+ otelSpanHeaders = (0, arvo_core_1.currentOpenTelemetryHeaders)();
163
+ _e.label = 1;
164
+ case 1:
165
+ _e.trys.push([1, 3, 4, 5]);
166
+ span.setStatus({ code: api_1.SpanStatusCode.OK });
167
+ Object.entries(event.otelAttributes).forEach(function (_a) {
168
+ var key = _a[0], value = _a[1];
169
+ return span.setAttribute("to_process.0.".concat(key), value);
170
+ });
171
+ if (this.contract.type !== event.type) {
172
+ throw new Error("Event type mismatch: Received '".concat(event.type, "', expected '").concat(this.contract.type, "'"));
173
+ }
174
+ (0, arvo_core_1.logToSpan)({
175
+ level: 'INFO',
176
+ message: "Event type '".concat(event.type, "' validated against contract '").concat(this.contract.uri, "'"),
177
+ });
178
+ parsedDataSchema = arvo_core_1.EventDataschemaUtil.parse(event);
179
+ if (!(parsedDataSchema === null || parsedDataSchema === void 0 ? void 0 : parsedDataSchema.version)) {
180
+ (0, arvo_core_1.logToSpan)({
181
+ level: 'WARNING',
182
+ message: "Version resolution failed for event with dataschema '".concat(event.dataschema, "'. Defaulting to latest version (=").concat(this.contract.version('latest').version, ") of contract (uri=").concat(this.contract.uri, ")"),
183
+ });
184
+ }
185
+ handlerContract = this.contract.version((_a = parsedDataSchema === null || parsedDataSchema === void 0 ? void 0 : parsedDataSchema.version) !== null && _a !== void 0 ? _a : 'latest');
186
+ (0, arvo_core_1.logToSpan)({
187
+ level: 'INFO',
188
+ message: "Processing event with contract version ".concat(handlerContract.version),
189
+ });
190
+ inputEventValidation = handlerContract.accepts.schema.safeParse(event.data);
191
+ if (inputEventValidation.error) {
192
+ throw new Error("Event payload validation failed: ".concat(inputEventValidation.error));
193
+ }
194
+ (0, arvo_core_1.logToSpan)({
195
+ level: 'INFO',
196
+ message: "Event payload validated successfully against contract ".concat(arvo_core_1.EventDataschemaUtil.create(handlerContract)),
197
+ });
193
198
  (0, arvo_core_1.logToSpan)({
194
- level: 'WARNING',
195
- message: "Version resolution failed for event with dataschema '".concat(event.dataschema, "'. Defaulting to latest version (=").concat(this.contract.version('latest').version, ") of contract (uri=").concat(this.contract.uri, ")"),
199
+ level: 'INFO',
200
+ message: "Executing handler for event type '".concat(event.type, "'"),
196
201
  });
197
- }
198
- handlerContract = this.contract.version((_a = parsedDataSchema === null || parsedDataSchema === void 0 ? void 0 : parsedDataSchema.version) !== null && _a !== void 0 ? _a : 'latest');
199
- (0, arvo_core_1.logToSpan)({
200
- level: 'INFO',
201
- message: "Processing event with contract version ".concat(handlerContract.version),
202
- });
203
- inputEventValidation = handlerContract.accepts.schema.safeParse(event.data);
204
- if (inputEventValidation.error) {
205
- throw new Error("Event payload validation failed: ".concat(inputEventValidation.error));
206
- }
207
- (0, arvo_core_1.logToSpan)({
208
- level: 'INFO',
209
- message: "Event payload validated successfully against contract ".concat(arvo_core_1.EventDataschemaUtil.create(handlerContract)),
210
- });
211
- (0, arvo_core_1.logToSpan)({
212
- level: 'INFO',
213
- message: "Executing handler for event type '".concat(event.type, "'"),
214
- });
215
- return [4 /*yield*/, this.handler[handlerContract.version]({
216
- event: event,
202
+ return [4 /*yield*/, this.handler[handlerContract.version]({
203
+ event: event,
204
+ source: this.source,
205
+ span: span,
206
+ })];
207
+ case 2:
208
+ _handleOutput = _e.sent();
209
+ if (!_handleOutput)
210
+ return [2 /*return*/, []];
211
+ outputs = [];
212
+ if (Array.isArray(_handleOutput)) {
213
+ outputs = _handleOutput;
214
+ }
215
+ else {
216
+ outputs = [_handleOutput];
217
+ }
218
+ eventFactory_1 = (0, arvo_core_1.createArvoEventFactory)(handlerContract);
219
+ result = (0, utils_1.eventHandlerOutputEventCreator)(outputs, otelSpanHeaders, this.source, event, this.executionunits, function (param, extensions) { return eventFactory_1.emits(param, extensions); });
220
+ (0, arvo_core_1.logToSpan)({
221
+ level: 'INFO',
222
+ message: "Event processing completed successfully. Generated ".concat(result.length, " event(s)"),
223
+ });
224
+ (0, arvo_core_1.logToSpan)({
225
+ level: 'INFO',
226
+ message: 'Event handled successfully',
227
+ });
228
+ return [2 /*return*/, result];
229
+ case 3:
230
+ error_1 = _e.sent();
231
+ eventFactory = (0, arvo_core_1.createArvoEventFactory)(this.contract.version('latest'));
232
+ (0, arvo_core_1.exceptionToSpan)(error_1);
233
+ span.setStatus({
234
+ code: api_1.SpanStatusCode.ERROR,
235
+ message: "Event processing failed: ".concat(error_1.message),
236
+ });
237
+ result = eventFactory.systemError({
217
238
  source: this.source,
218
- span: span,
219
- })];
220
- case 2:
221
- _handleOutput = _e.sent();
222
- if (!_handleOutput)
223
- return [2 /*return*/, []];
224
- outputs = [];
225
- if (Array.isArray(_handleOutput)) {
226
- outputs = _handleOutput;
227
- }
228
- else {
229
- outputs = [_handleOutput];
230
- }
231
- eventFactory_1 = (0, arvo_core_1.createArvoEventFactory)(handlerContract);
232
- result = (0, utils_1.eventHandlerOutputEventCreator)(outputs, otelSpanHeaders, this.source, event, this.executionunits, function (param, extensions) { return eventFactory_1.emits(param, extensions); });
233
- (0, arvo_core_1.logToSpan)({
234
- level: 'INFO',
235
- message: "Event processing completed successfully. Generated ".concat(result.length, " event(s)"),
236
- });
237
- (0, arvo_core_1.logToSpan)({
238
- level: 'INFO',
239
- message: 'Event handled successfully',
240
- });
241
- return [2 /*return*/, result];
242
- case 3:
243
- error_1 = _e.sent();
244
- eventFactory = (0, arvo_core_1.createArvoEventFactory)(this.contract.version('latest'));
245
- (0, arvo_core_1.exceptionToSpan)(error_1);
246
- span.setStatus({
247
- code: api_1.SpanStatusCode.ERROR,
248
- message: "Event processing failed: ".concat(error_1.message),
249
- });
250
- result = eventFactory.systemError({
251
- source: this.source,
252
- subject: event.subject,
253
- // The system error must always got back to
254
- // the source
255
- to: event.source,
256
- error: error_1,
257
- executionunits: this.executionunits,
258
- traceparent: (_b = otelSpanHeaders.traceparent) !== null && _b !== void 0 ? _b : undefined,
259
- tracestate: (_c = otelSpanHeaders.tracestate) !== null && _c !== void 0 ? _c : undefined,
260
- accesscontrol: (_d = event.accesscontrol) !== null && _d !== void 0 ? _d : undefined,
261
- }, {});
262
- Object.entries(result.otelAttributes).forEach(function (_a) {
263
- var key = _a[0], value = _a[1];
264
- return span.setAttribute("to_emit.0.".concat(key), value);
265
- });
266
- return [2 /*return*/, [result]];
267
- case 4:
268
- span.end();
269
- return [7 /*endfinally*/];
270
- case 5: return [2 /*return*/];
271
- }
272
- });
273
- }); },
274
- })];
239
+ subject: event.subject,
240
+ // The system error must always got back to
241
+ // the source
242
+ to: event.source,
243
+ error: error_1,
244
+ executionunits: this.executionunits,
245
+ traceparent: (_b = otelSpanHeaders.traceparent) !== null && _b !== void 0 ? _b : undefined,
246
+ tracestate: (_c = otelSpanHeaders.tracestate) !== null && _c !== void 0 ? _c : undefined,
247
+ accesscontrol: (_d = event.accesscontrol) !== null && _d !== void 0 ? _d : undefined,
248
+ }, {});
249
+ Object.entries(result.otelAttributes).forEach(function (_a) {
250
+ var key = _a[0], value = _a[1];
251
+ return span.setAttribute("to_emit.0.".concat(key), value);
252
+ });
253
+ return [2 /*return*/, [result]];
254
+ case 4:
255
+ span.end();
256
+ return [7 /*endfinally*/];
257
+ case 5: return [2 /*return*/];
258
+ }
259
+ });
260
+ }); } }))];
275
261
  case 1: return [2 /*return*/, _a.sent()];
276
262
  }
277
263
  });
@@ -69,6 +69,7 @@ var api_1 = require("@opentelemetry/api");
69
69
  var arvo_core_1 = require("arvo-core");
70
70
  var utils_1 = require("../utils");
71
71
  var AbstractArvoEventHandler_1 = __importDefault(require("../AbstractArvoEventHandler"));
72
+ var utils_2 = require("../utils");
72
73
  /**
73
74
  * MultiArvoEventHandler processes multiple event types without being bound to specific contracts.
74
75
  * Manages event execution, telemetry tracking, and error handling for diverse event streams.
@@ -112,82 +113,68 @@ var MultiArvoEventHandler = /** @class */ (function (_super) {
112
113
  */
113
114
  MultiArvoEventHandler.prototype.execute = function (event_1) {
114
115
  return __awaiter(this, arguments, void 0, function (event, opentelemetry) {
116
+ var otelConfig;
115
117
  var _this = this;
116
118
  if (opentelemetry === void 0) { opentelemetry = {
117
119
  inheritFrom: 'EVENT',
118
120
  }; }
119
121
  return __generator(this, function (_a) {
120
122
  switch (_a.label) {
121
- case 0: return [4 /*yield*/, arvo_core_1.ArvoOpenTelemetry.getInstance().startActiveSpan({
122
- name: 'MutliArvoEventHandler',
123
- spanOptions: this.spanOptions,
124
- disableSpanManagement: true,
125
- context: opentelemetry.inheritFrom === 'EVENT'
126
- ? {
127
- inheritFrom: 'TRACE_HEADERS',
128
- traceHeaders: {
129
- traceparent: event.traceparent,
130
- tracestate: event.tracestate,
131
- },
132
- }
133
- : {
134
- inheritFrom: 'CONTEXT',
135
- context: api_1.context.active(),
136
- },
137
- fn: function (span) { return __awaiter(_this, void 0, void 0, function () {
138
- var otelSpanHeaders, _handlerOutput, outputs, resultingEvents, error_1;
139
- return __generator(this, function (_a) {
140
- switch (_a.label) {
141
- case 0:
142
- otelSpanHeaders = (0, arvo_core_1.currentOpenTelemetryHeaders)();
143
- _a.label = 1;
144
- case 1:
145
- _a.trys.push([1, 3, 4, 5]);
146
- span.setStatus({ code: api_1.SpanStatusCode.OK });
147
- Object.entries(event.otelAttributes).forEach(function (_a) {
148
- var key = _a[0], value = _a[1];
149
- return span.setAttribute("to_process.0.".concat(key), value);
150
- });
151
- (0, arvo_core_1.logToSpan)({
152
- level: 'INFO',
153
- message: "Initiating event resolution - Type: ".concat(event.type, ", Source: ").concat(event.source, ", Destination: ").concat(event.to),
154
- });
155
- if (event.to !== this.source) {
156
- throw new Error("Event destination mismatch: Expected '".concat(this.source, "', received '").concat(event.to, "'"));
157
- }
158
- return [4 /*yield*/, this.handler({
159
- event: event,
160
- source: this.source,
161
- span: span
162
- })];
163
- case 2:
164
- _handlerOutput = _a.sent();
165
- if (!_handlerOutput)
166
- return [2 /*return*/, []];
167
- outputs = [];
168
- if (Array.isArray(_handlerOutput)) {
169
- outputs = _handlerOutput;
170
- }
171
- else {
172
- outputs = [_handlerOutput];
173
- }
174
- resultingEvents = (0, utils_1.eventHandlerOutputEventCreator)(outputs, otelSpanHeaders, this.source, event, this.executionunits, function (param, extensions) { return (0, arvo_core_1.createArvoEvent)(param, extensions); });
175
- (0, arvo_core_1.logToSpan)({
176
- level: 'INFO',
177
- message: "Event processing completed successfully - Generated ".concat(resultingEvents.length, " new event(s)"),
178
- });
179
- return [2 /*return*/, resultingEvents];
180
- case 3:
181
- error_1 = _a.sent();
182
- return [2 /*return*/, (0, utils_1.createHandlerErrorOutputEvent)(error_1, otelSpanHeaders, "sys.".concat(this.source, ".error"), this.source, event, this.executionunits, function (param, extensions) { return (0, arvo_core_1.createArvoEvent)(param, extensions); })];
183
- case 4:
184
- span.end();
185
- return [7 /*endfinally*/];
186
- case 5: return [2 /*return*/];
187
- }
188
- });
189
- }); },
190
- })];
123
+ case 0:
124
+ otelConfig = (0, utils_2.createEventHandlerTelemetryConfig)('MutliArvoEventHandler', this.spanOptions, opentelemetry, event);
125
+ return [4 /*yield*/, arvo_core_1.ArvoOpenTelemetry.getInstance().startActiveSpan(__assign(__assign({}, otelConfig), { fn: function (span) { return __awaiter(_this, void 0, void 0, function () {
126
+ var otelSpanHeaders, _handlerOutput, outputs, resultingEvents, error_1;
127
+ return __generator(this, function (_a) {
128
+ switch (_a.label) {
129
+ case 0:
130
+ otelSpanHeaders = (0, arvo_core_1.currentOpenTelemetryHeaders)();
131
+ _a.label = 1;
132
+ case 1:
133
+ _a.trys.push([1, 3, 4, 5]);
134
+ span.setStatus({ code: api_1.SpanStatusCode.OK });
135
+ Object.entries(event.otelAttributes).forEach(function (_a) {
136
+ var key = _a[0], value = _a[1];
137
+ return span.setAttribute("to_process.0.".concat(key), value);
138
+ });
139
+ (0, arvo_core_1.logToSpan)({
140
+ level: 'INFO',
141
+ message: "Initiating event resolution - Type: ".concat(event.type, ", Source: ").concat(event.source, ", Destination: ").concat(event.to),
142
+ });
143
+ if (event.to !== this.source) {
144
+ throw new Error("Event destination mismatch: Expected '".concat(this.source, "', received '").concat(event.to, "'"));
145
+ }
146
+ return [4 /*yield*/, this.handler({
147
+ event: event,
148
+ source: this.source,
149
+ span: span
150
+ })];
151
+ case 2:
152
+ _handlerOutput = _a.sent();
153
+ if (!_handlerOutput)
154
+ return [2 /*return*/, []];
155
+ outputs = [];
156
+ if (Array.isArray(_handlerOutput)) {
157
+ outputs = _handlerOutput;
158
+ }
159
+ else {
160
+ outputs = [_handlerOutput];
161
+ }
162
+ resultingEvents = (0, utils_1.eventHandlerOutputEventCreator)(outputs, otelSpanHeaders, this.source, event, this.executionunits, function (param, extensions) { return (0, arvo_core_1.createArvoEvent)(param, extensions); });
163
+ (0, arvo_core_1.logToSpan)({
164
+ level: 'INFO',
165
+ message: "Event processing completed successfully - Generated ".concat(resultingEvents.length, " new event(s)"),
166
+ });
167
+ return [2 /*return*/, resultingEvents];
168
+ case 3:
169
+ error_1 = _a.sent();
170
+ return [2 /*return*/, (0, utils_1.createHandlerErrorOutputEvent)(error_1, otelSpanHeaders, "sys.".concat(this.source, ".error"), this.source, event, this.executionunits, function (param, extensions) { return (0, arvo_core_1.createArvoEvent)(param, extensions); })];
171
+ case 4:
172
+ span.end();
173
+ return [7 /*endfinally*/];
174
+ case 5: return [2 /*return*/];
175
+ }
176
+ });
177
+ }); } }))];
191
178
  case 1: return [2 /*return*/, _a.sent()];
192
179
  }
193
180
  });
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  import { ArvoEvent, CreateArvoEvent, OpenTelemetryHeaders } from 'arvo-core';
2
2
  import { ArvoEventHandlerFunctionOutput } from './ArvoEventHandler/types';
3
3
  import { MultiArvoEventHandlerFunctionOutput } from './MultiArvoEventHandler/types';
4
+ import { SpanOptions } from '@opentelemetry/api';
5
+ import { ArvoEventHandlerOpenTelemetryOptions } from './types';
4
6
  /**
5
7
  * Checks if the item is null or undefined.
6
8
  *
@@ -76,3 +78,19 @@ export declare const createHandlerErrorOutputEvent: (error: Error, otelSpanHeade
76
78
  * @returns True if the string contains only alphanumeric characters, false otherwise.
77
79
  */
78
80
  export declare function isLowerAlphanumeric(input: string): boolean;
81
+ export declare const createEventHandlerTelemetryConfig: (name: string, options: SpanOptions, contextConfig: ArvoEventHandlerOpenTelemetryOptions, event: ArvoEvent) => {
82
+ name: string;
83
+ disableSpanManagement: boolean;
84
+ context: {
85
+ inheritFrom: "TRACE_HEADERS";
86
+ traceHeaders: {
87
+ traceparent: string | null;
88
+ tracestate: string | null;
89
+ };
90
+ context?: undefined;
91
+ } | {
92
+ inheritFrom: "CONTEXT";
93
+ context: import("@opentelemetry/api").Context;
94
+ traceHeaders?: undefined;
95
+ };
96
+ };
package/dist/utils.js CHANGED
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  return t;
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.createHandlerErrorOutputEvent = exports.eventHandlerOutputEventCreator = void 0;
25
+ exports.createEventHandlerTelemetryConfig = exports.createHandlerErrorOutputEvent = exports.eventHandlerOutputEventCreator = void 0;
26
26
  exports.isNullOrUndefined = isNullOrUndefined;
27
27
  exports.getValueOrDefault = getValueOrDefault;
28
28
  exports.coalesce = coalesce;
@@ -167,3 +167,20 @@ function isLowerAlphanumeric(input) {
167
167
  var alphanumericRegex = /^[a-z0-9.]+$/;
168
168
  return alphanumericRegex.test(input);
169
169
  }
170
+ var createEventHandlerTelemetryConfig = function (name, options, contextConfig, event) { return ({
171
+ name: name,
172
+ disableSpanManagement: true,
173
+ context: contextConfig.inheritFrom === 'EVENT'
174
+ ? {
175
+ inheritFrom: 'TRACE_HEADERS',
176
+ traceHeaders: {
177
+ traceparent: event.traceparent,
178
+ tracestate: event.tracestate,
179
+ },
180
+ }
181
+ : {
182
+ inheritFrom: 'CONTEXT',
183
+ context: api_1.context.active(),
184
+ },
185
+ }); };
186
+ exports.createEventHandlerTelemetryConfig = createEventHandlerTelemetryConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arvo-event-handler",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Type-safe event handler system with versioning, telemetry, and contract validation for distributed Arvo event-driven architectures, featuring routing and multi-handler support.",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {