arvo-core 1.0.20 → 1.0.21
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -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',
|
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',
|
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,
|
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',
|
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,
|
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',
|
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,
|
103
|
+
}, datacontenttype: schema_1.ArvoDataContentType, dataschema: _this.contract.uri }), extensions, telemetryContext);
|
104
104
|
});
|
105
105
|
};
|
106
106
|
return ArvoEventFactory;
|