arvo-core 1.0.20 → 1.0.22

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -40,7 +40,7 @@
40
40
 
41
41
  - Fix a type bug in ArvoEvent creation
42
42
 
43
- ## [1.0.20] - 2024-09-07
43
+ ## [1.0.22] - 2024-09-07
44
44
 
45
- - Updated OpenTelemetry
45
+ - Updated OpenTelemetry propagation and fixed propagation in the event factory
46
46
 
@@ -47,7 +47,7 @@ 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 (telemetryContext) {
50
+ return (0, OpenTelemetry_1.createOtelSpan)(telemetry || 'ArvoEvent Creation Tracer', "createArvoEvent<".concat(event.type, ">"), {}, 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,12 +54,12 @@ var ArvoEventFactory = /** @class */ (function () {
54
54
  */
55
55
  ArvoEventFactory.prototype.accepts = function (event, extensions, telemetry) {
56
56
  var _this = this;
57
- return (0, OpenTelemetry_1.createOtelSpan)(telemetry || 'ArvoEvent Creation Tracer', 'ContractualArvoEventFactory.accepts', {}, function () {
57
+ return (0, OpenTelemetry_1.createOtelSpan)(telemetry || 'ArvoEvent Creation Tracer', "ContractualArvoEventFactory<".concat(this.contract.uri, ">.accepts<").concat(this.contract.accepts.type, ">.create"), {}, function (telemetryContext) {
58
58
  var validationResult = _this.contract.validateInput(_this.contract.accepts.type, event.data);
59
59
  if (!validationResult.success) {
60
60
  throw new Error("Accept Event data validation failed: ".concat(validationResult.error.message));
61
61
  }
62
- return (0, helpers_1.createArvoEvent)(__assign(__assign({}, event), { type: _this.contract.accepts.type, datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri, data: validationResult.data }), extensions, telemetry);
62
+ return (0, helpers_1.createArvoEvent)(__assign(__assign({}, event), { type: _this.contract.accepts.type, datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri, data: validationResult.data }), extensions, telemetryContext);
63
63
  });
64
64
  };
65
65
  /**
@@ -75,12 +75,12 @@ var ArvoEventFactory = /** @class */ (function () {
75
75
  */
76
76
  ArvoEventFactory.prototype.emits = function (event, extensions, telemetry) {
77
77
  var _this = this;
78
- return (0, OpenTelemetry_1.createOtelSpan)(telemetry || 'ArvoEvent Creation Tracer', 'ContractualArvoEventFactory.emits', {}, function () {
78
+ return (0, OpenTelemetry_1.createOtelSpan)(telemetry || 'ArvoEvent Creation Tracer', "ContractualArvoEventFactory<".concat(this.contract.uri, ">.emits<").concat(event.type, ">.create"), {}, function (telemetryContext) {
79
79
  var validationResult = _this.contract.validateOutput(event.type, event.data);
80
80
  if (!validationResult.success) {
81
81
  throw new Error("Emit Event data validation failed: ".concat(validationResult.error.message));
82
82
  }
83
- return (0, helpers_1.createArvoEvent)(__assign(__assign({}, event), { datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri, data: validationResult.data }), extensions, telemetry);
83
+ return (0, helpers_1.createArvoEvent)(__assign(__assign({}, event), { datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri, data: validationResult.data }), extensions, telemetryContext);
84
84
  });
85
85
  };
86
86
  /**
@@ -94,13 +94,13 @@ var ArvoEventFactory = /** @class */ (function () {
94
94
  */
95
95
  ArvoEventFactory.prototype.systemError = function (event, extensions, telemetry) {
96
96
  var _this = this;
97
- return (0, OpenTelemetry_1.createOtelSpan)(telemetry || 'ArvoEvent Creation Tracer', 'ContractualArvoEventFactory.systemError', {}, function () {
97
+ return (0, OpenTelemetry_1.createOtelSpan)(telemetry || 'ArvoEvent Creation Tracer', "ContractualArvoEventFactory<".concat(this.contract.uri, ">.systemError<sys.").concat(this.contract.accepts.type, ".error>.create"), {}, function (telemetryContext) {
98
98
  var error = event.error, _events = __rest(event, ["error"]);
99
99
  return (0, helpers_1.createArvoEvent)(__assign(__assign({}, event), { type: "sys.".concat(_this.contract.accepts.type, ".error"), data: {
100
100
  errorName: error.name,
101
101
  errorMessage: error.message,
102
102
  errorStack: error.stack || null,
103
- }, datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri }), extensions, telemetry);
103
+ }, datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri }), extensions, telemetryContext);
104
104
  });
105
105
  };
106
106
  return ArvoEventFactory;
@@ -47,9 +47,6 @@ var getTelemetryCarrier = function (span, activeContext) {
47
47
  tracestate: null,
48
48
  };
49
49
  api_1.propagation.inject(activeContext, carrier);
50
- if (!carrier.traceparent) {
51
- carrier.traceparent = "00-".concat(span.spanContext().traceId, "-").concat(span.spanContext().spanId, "-0").concat(span.spanContext().traceFlags);
52
- }
53
50
  return carrier;
54
51
  };
55
52
  exports.getTelemetryCarrier = getTelemetryCarrier;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arvo-core",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
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": {