@event-driven-io/emmett 0.43.0-beta.23 → 0.43.0-beta.24
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/dist/index.cjs +266 -302
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +98 -112
- package/dist/index.d.ts +98 -112
- package/dist/index.js +262 -297
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { n as __reExport, t as __exportAll } from "./chunk-zc3tnsvq.js";
|
|
|
2
2
|
import { _ as isValidYYYYMMDD, a as IllegalStateError, c as isErrorConstructor, d as assertPositiveNumber, f as assertUnsignedBigInt, g as formatDateToUtcYYYYMMDD, h as isString, i as EmmettError, l as ValidationErrors, m as isNumber, n as ConcurrencyError, o as NotFoundError, p as isBigint, r as ConcurrencyInMemoryDatabaseError, s as ValidationError, t as isPluginConfig, u as assertNotEmptyString, v as parseDateFromUtcYYYYMMDD } from "./plugins-DgfqJ5af.js";
|
|
3
3
|
import { v4, v7 } from "uuid";
|
|
4
4
|
import retry from "async-retry";
|
|
5
|
-
import { MessagingAttributes, ObservabilityScope, noopMeter, noopScope, noopTracer } from "@event-driven-io/almanac";
|
|
5
|
+
import { LogEvent, MessagingAttributes, ObservabilityScope, noopMeter, noopScope, noopTracer } from "@event-driven-io/almanac";
|
|
6
6
|
|
|
7
7
|
export * from "@event-driven-io/almanac"
|
|
8
8
|
|
|
@@ -620,6 +620,11 @@ const bigIntReplacer = (_key, value) => {
|
|
|
620
620
|
const dateReplacer = (_key, value) => {
|
|
621
621
|
return value instanceof Date ? value.toISOString() : value;
|
|
622
622
|
};
|
|
623
|
+
const errorReplacer = (_key, value) => value instanceof Error ? {
|
|
624
|
+
type: value.constructor.name || "error",
|
|
625
|
+
message: value.message,
|
|
626
|
+
stack: value.stack
|
|
627
|
+
} : value;
|
|
623
628
|
const isFirstLetterNumeric = (str) => {
|
|
624
629
|
const c = str.charCodeAt(0);
|
|
625
630
|
return c >= 48 && c <= 57;
|
|
@@ -661,11 +666,12 @@ const composeJSONRevivers = (...revivers) => {
|
|
|
661
666
|
if (filteredRevivers.length === 0) return void 0;
|
|
662
667
|
return (key, value, context) => filteredRevivers.reduce((accValue, reviver) => reviver(key, accValue, context), value);
|
|
663
668
|
};
|
|
664
|
-
const JSONReplacer = (opts) => composeJSONReplacers(opts?.replacer, opts?.failOnBigIntSerialization !== true ? JSONReplacers.bigInt : void 0, opts?.useDefaultDateSerialization !== true ? JSONReplacers.date : void 0);
|
|
669
|
+
const JSONReplacer = (opts) => composeJSONReplacers(opts?.replacer, opts?.failOnBigIntSerialization !== true ? JSONReplacers.bigInt : void 0, opts?.useDefaultDateSerialization !== true ? JSONReplacers.date : void 0, opts?.skipErrorSerialization !== true ? JSONReplacers.error : void 0);
|
|
665
670
|
const JSONReviver = (opts) => composeJSONRevivers(opts?.reviver, opts?.parseBigInts === true ? JSONRevivers.bigInt : void 0, opts?.parseDates === true ? JSONRevivers.date : void 0);
|
|
666
671
|
const JSONReplacers = {
|
|
667
672
|
bigInt: bigIntReplacer,
|
|
668
|
-
date: dateReplacer
|
|
673
|
+
date: dateReplacer,
|
|
674
|
+
error: errorReplacer
|
|
669
675
|
};
|
|
670
676
|
const JSONRevivers = {
|
|
671
677
|
bigInt: bigIntReviver,
|
|
@@ -674,8 +680,19 @@ const JSONRevivers = {
|
|
|
674
680
|
const jsonSerializer = (options) => {
|
|
675
681
|
const defaultReplacer = JSONReplacer(options);
|
|
676
682
|
const defaultReviver = JSONReviver(options);
|
|
683
|
+
const defaultFormat = options?.format ?? "compact";
|
|
684
|
+
const defaultSafe = options?.safe ?? false;
|
|
677
685
|
return {
|
|
678
|
-
serialize: (object, serializerOptions) =>
|
|
686
|
+
serialize: (object, serializerOptions) => {
|
|
687
|
+
const replacer = serializerOptions ? JSONReplacer(serializerOptions) : defaultReplacer;
|
|
688
|
+
const indent = (serializerOptions?.format ?? defaultFormat) === "pretty" ? 2 : void 0;
|
|
689
|
+
if (serializerOptions?.safe ?? defaultSafe) try {
|
|
690
|
+
return JSON.stringify(object, replacer, indent);
|
|
691
|
+
} catch (e) {
|
|
692
|
+
return `{"__serializationError":${JSON.stringify(String(e))}}`;
|
|
693
|
+
}
|
|
694
|
+
return JSON.stringify(object, replacer, indent);
|
|
695
|
+
},
|
|
679
696
|
deserialize: (payload, deserializerOptions) => JSON.parse(payload, deserializerOptions ? JSONReviver(deserializerOptions) : defaultReviver)
|
|
680
697
|
};
|
|
681
698
|
};
|
|
@@ -979,6 +996,15 @@ const getInMemoryDatabase = () => {
|
|
|
979
996
|
} };
|
|
980
997
|
};
|
|
981
998
|
|
|
999
|
+
//#endregion
|
|
1000
|
+
//#region src/processors/checkpoints.ts
|
|
1001
|
+
const ProcessorCheckpoint = (checkpoint) => checkpoint;
|
|
1002
|
+
const bigIntProcessorCheckpoint = (value) => bigInt.toNormalizedString(value);
|
|
1003
|
+
const parseBigIntProcessorCheckpoint = (value) => BigInt(value);
|
|
1004
|
+
const getCheckpoint = (message) => {
|
|
1005
|
+
return message.metadata.checkpoint;
|
|
1006
|
+
};
|
|
1007
|
+
|
|
982
1008
|
//#endregion
|
|
983
1009
|
//#region src/observability/attributes.ts
|
|
984
1010
|
const EmmettAttributes = {
|
|
@@ -1066,281 +1092,21 @@ const MessagingSystemName = "emmett";
|
|
|
1066
1092
|
|
|
1067
1093
|
//#endregion
|
|
1068
1094
|
//#region src/observability/options.ts
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
attributeTarget: options?.observability?.attributeTarget ?? parent?.observability?.attributeTarget ?? "both"
|
|
1074
|
-
});
|
|
1075
|
-
const resolveWorkflowObservability = (options, parent) => ({
|
|
1076
|
-
tracer: options?.observability?.tracer ?? parent?.observability?.tracer ?? noopTracer(),
|
|
1077
|
-
meter: options?.observability?.meter ?? parent?.observability?.meter ?? noopMeter(),
|
|
1078
|
-
propagation: options?.observability?.propagation ?? parent?.observability?.propagation ?? "links",
|
|
1079
|
-
attributeTarget: options?.observability?.attributeTarget ?? parent?.observability?.attributeTarget ?? "both",
|
|
1080
|
-
includeMessagePayloads: options?.observability?.includeMessagePayloads ?? parent?.observability?.includeMessagePayloads ?? false
|
|
1081
|
-
});
|
|
1082
|
-
|
|
1083
|
-
//#endregion
|
|
1084
|
-
//#region src/observability/tracer.ts
|
|
1085
|
-
const tracer = () => {};
|
|
1086
|
-
const LogLevel = {
|
|
1087
|
-
DISABLED: "DISABLED",
|
|
1088
|
-
INFO: "INFO",
|
|
1089
|
-
LOG: "LOG",
|
|
1090
|
-
WARN: "WARN",
|
|
1091
|
-
ERROR: "ERROR"
|
|
1092
|
-
};
|
|
1093
|
-
const LogStyle = {
|
|
1094
|
-
RAW: "RAW",
|
|
1095
|
-
PRETTY: "PRETTY"
|
|
1096
|
-
};
|
|
1097
|
-
const getEnvVariable = (name) => {
|
|
1098
|
-
try {
|
|
1099
|
-
if (typeof process !== "undefined" && process.env) return process.env[name];
|
|
1100
|
-
return;
|
|
1101
|
-
} catch {
|
|
1102
|
-
return;
|
|
1103
|
-
}
|
|
1104
|
-
};
|
|
1105
|
-
const shouldLog = (logLevel) => {
|
|
1106
|
-
const definedLogLevel = getEnvVariable("DUMBO_LOG_LEVEL") ?? LogLevel.ERROR;
|
|
1107
|
-
if (definedLogLevel === LogLevel.ERROR && logLevel === LogLevel.ERROR) return true;
|
|
1108
|
-
if (definedLogLevel === LogLevel.WARN && [LogLevel.ERROR, LogLevel.WARN].includes(logLevel)) return true;
|
|
1109
|
-
if (definedLogLevel === LogLevel.LOG && [
|
|
1110
|
-
LogLevel.ERROR,
|
|
1111
|
-
LogLevel.WARN,
|
|
1112
|
-
LogLevel.LOG
|
|
1113
|
-
].includes(logLevel)) return true;
|
|
1114
|
-
if (definedLogLevel === LogLevel.INFO && [
|
|
1115
|
-
LogLevel.ERROR,
|
|
1116
|
-
LogLevel.WARN,
|
|
1117
|
-
LogLevel.LOG,
|
|
1118
|
-
LogLevel.INFO
|
|
1119
|
-
].includes(logLevel)) return true;
|
|
1120
|
-
return false;
|
|
1121
|
-
};
|
|
1122
|
-
const nulloTraceEventRecorder = () => {};
|
|
1123
|
-
const getTraceEventFormatter = (logStyle, serializer) => (event) => {
|
|
1124
|
-
serializer = serializer ?? JSONSerializer.from();
|
|
1125
|
-
switch (logStyle) {
|
|
1126
|
-
case "RAW": return serializer.serialize(event);
|
|
1127
|
-
case "PRETTY": return serializer.serialize(event);
|
|
1128
|
-
}
|
|
1129
|
-
};
|
|
1130
|
-
const getTraceEventRecorder = (logLevel, logStyle) => {
|
|
1131
|
-
const format = getTraceEventFormatter(logStyle);
|
|
1132
|
-
switch (logLevel) {
|
|
1133
|
-
case "DISABLED": return nulloTraceEventRecorder;
|
|
1134
|
-
case "INFO": return (event) => console.info(format(event));
|
|
1135
|
-
case "LOG": return (event) => console.log(format(event));
|
|
1136
|
-
case "WARN": return (event) => console.warn(format(event));
|
|
1137
|
-
case "ERROR": return (event) => console.error(format(event));
|
|
1138
|
-
}
|
|
1139
|
-
};
|
|
1140
|
-
const recordTraceEvent = (logLevel, eventName, attributes) => {
|
|
1141
|
-
if (!shouldLog(LogLevel.LOG)) return;
|
|
1142
|
-
const event = {
|
|
1143
|
-
name: eventName,
|
|
1144
|
-
timestamp: (/* @__PURE__ */ new Date()).getTime(),
|
|
1145
|
-
...attributes
|
|
1095
|
+
const mergeObservabilityOptions = (options, defaults) => {
|
|
1096
|
+
const observability = defaults === void 0 ? options.observability : options.observability === void 0 ? defaults : {
|
|
1097
|
+
...defaults,
|
|
1098
|
+
...options.observability
|
|
1146
1099
|
};
|
|
1147
|
-
|
|
1148
|
-
};
|
|
1149
|
-
tracer.info = (eventName, attributes) => recordTraceEvent(LogLevel.INFO, eventName, attributes);
|
|
1150
|
-
tracer.warn = (eventName, attributes) => recordTraceEvent(LogLevel.WARN, eventName, attributes);
|
|
1151
|
-
tracer.log = (eventName, attributes) => recordTraceEvent(LogLevel.LOG, eventName, attributes);
|
|
1152
|
-
tracer.error = (eventName, attributes) => recordTraceEvent(LogLevel.ERROR, eventName, attributes);
|
|
1153
|
-
|
|
1154
|
-
//#endregion
|
|
1155
|
-
//#region src/eventStore/observability/eventStoreCollector.ts
|
|
1156
|
-
const resolveEventStoreObservability = (options, parent) => ({
|
|
1157
|
-
tracer: options?.observability?.tracer ?? parent?.observability?.tracer ?? noopTracer(),
|
|
1158
|
-
meter: options?.observability?.meter ?? parent?.observability?.meter ?? noopMeter(),
|
|
1159
|
-
attributeTarget: options?.observability?.attributeTarget ?? parent?.observability?.attributeTarget ?? "both"
|
|
1160
|
-
});
|
|
1161
|
-
const eventStoreCollector = (observability) => {
|
|
1162
|
-
const A = EmmettAttributes;
|
|
1163
|
-
const M = MessagingAttributes;
|
|
1164
|
-
const streamReadingDuration = observability.meter.histogram(EmmettMetrics.stream.readingDuration);
|
|
1165
|
-
const streamReadingSize = observability.meter.histogram(EmmettMetrics.stream.readingSize);
|
|
1166
|
-
const eventReadingCount = observability.meter.counter(EmmettMetrics.event.readingCount);
|
|
1167
|
-
const streamAppendingDuration = observability.meter.histogram(EmmettMetrics.stream.appendingDuration);
|
|
1168
|
-
const streamAppendingSize = observability.meter.histogram(EmmettMetrics.stream.appendingSize);
|
|
1169
|
-
const eventAppendingCount = observability.meter.counter(EmmettMetrics.event.appendingCount);
|
|
1100
|
+
if (observability === options.observability) return options;
|
|
1170
1101
|
return {
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
return observability.tracer.startSpan("eventStore.readStream", async (span) => {
|
|
1174
|
-
span.setAttributes({
|
|
1175
|
-
[A.eventStore.operation]: "readStream",
|
|
1176
|
-
[A.stream.name]: streamName,
|
|
1177
|
-
[M.operation.type]: "receive",
|
|
1178
|
-
[M.destination.name]: streamName,
|
|
1179
|
-
[M.system]: MessagingSystemName
|
|
1180
|
-
});
|
|
1181
|
-
let status = "success";
|
|
1182
|
-
try {
|
|
1183
|
-
const result = await fn();
|
|
1184
|
-
const events = result.events;
|
|
1185
|
-
span.setAttributes({
|
|
1186
|
-
[A.eventStore.read.status]: status,
|
|
1187
|
-
[A.eventStore.read.eventCount]: events.length,
|
|
1188
|
-
[A.eventStore.read.eventTypes]: [...new Set(events.map((e) => e.type))]
|
|
1189
|
-
});
|
|
1190
|
-
streamReadingSize.record(events.length, { [A.eventStore.read.status]: status });
|
|
1191
|
-
for (const event of events) eventReadingCount.add(1, { [A.event.type]: event.type });
|
|
1192
|
-
return result;
|
|
1193
|
-
} catch (err) {
|
|
1194
|
-
status = "failure";
|
|
1195
|
-
span.setAttributes({ [A.eventStore.read.status]: status });
|
|
1196
|
-
throw err;
|
|
1197
|
-
} finally {
|
|
1198
|
-
streamReadingDuration.record(Date.now() - start, { [A.eventStore.read.status]: status });
|
|
1199
|
-
}
|
|
1200
|
-
});
|
|
1201
|
-
},
|
|
1202
|
-
instrumentAppend: (streamName, events, fn) => {
|
|
1203
|
-
const start = Date.now();
|
|
1204
|
-
return observability.tracer.startSpan("eventStore.appendToStream", async (span) => {
|
|
1205
|
-
span.setAttributes({
|
|
1206
|
-
[A.eventStore.operation]: "appendToStream",
|
|
1207
|
-
[A.stream.name]: streamName,
|
|
1208
|
-
[A.eventStore.append.batchSize]: events.length,
|
|
1209
|
-
[M.operation.type]: "send",
|
|
1210
|
-
[M.batch.messageCount]: events.length,
|
|
1211
|
-
[M.destination.name]: streamName,
|
|
1212
|
-
[M.system]: MessagingSystemName
|
|
1213
|
-
});
|
|
1214
|
-
let status = "success";
|
|
1215
|
-
try {
|
|
1216
|
-
const result = await fn();
|
|
1217
|
-
span.setAttributes({
|
|
1218
|
-
[A.eventStore.append.status]: status,
|
|
1219
|
-
[A.stream.versionAfter]: Number(result.nextExpectedStreamVersion)
|
|
1220
|
-
});
|
|
1221
|
-
streamAppendingSize.record(events.length, { [A.eventStore.append.status]: status });
|
|
1222
|
-
for (const event of events) eventAppendingCount.add(1, { [A.event.type]: event.type });
|
|
1223
|
-
return result;
|
|
1224
|
-
} catch (err) {
|
|
1225
|
-
status = "failure";
|
|
1226
|
-
span.setAttributes({ [A.eventStore.append.status]: status });
|
|
1227
|
-
throw err;
|
|
1228
|
-
} finally {
|
|
1229
|
-
streamAppendingDuration.record(Date.now() - start, { [A.eventStore.append.status]: status });
|
|
1230
|
-
}
|
|
1231
|
-
});
|
|
1232
|
-
}
|
|
1233
|
-
};
|
|
1234
|
-
};
|
|
1235
|
-
|
|
1236
|
-
//#endregion
|
|
1237
|
-
//#region src/observability/collectors/consumerCollector.ts
|
|
1238
|
-
const consumerCollector = (observability) => {
|
|
1239
|
-
const { startScope } = ObservabilityScope({
|
|
1240
|
-
...observability,
|
|
1241
|
-
attributePrefix: "emmett"
|
|
1242
|
-
});
|
|
1243
|
-
const A = EmmettAttributes;
|
|
1244
|
-
const M = MessagingAttributes;
|
|
1245
|
-
const pollDuration = observability.meter.histogram(EmmettMetrics.consumer.pollDuration);
|
|
1246
|
-
const deliveryDuration = observability.meter.histogram(EmmettMetrics.consumer.deliveryDuration);
|
|
1247
|
-
return {
|
|
1248
|
-
tracePoll: (context, fn) => {
|
|
1249
|
-
if (observability.pollTracing === "off" || observability.pollTracing === "active" && context.batchSize === 0) return fn(noopScope);
|
|
1250
|
-
return startScope("consumer.poll", async (scope) => {
|
|
1251
|
-
scope.setAttributes({
|
|
1252
|
-
[A.scope.type]: ScopeTypes.consumer,
|
|
1253
|
-
[A.consumer.batchSize]: context.batchSize,
|
|
1254
|
-
[A.consumer.processorCount]: context.processorCount,
|
|
1255
|
-
[M.system]: MessagingSystemName,
|
|
1256
|
-
[M.operation.type]: "receive",
|
|
1257
|
-
...context.empty ? { "emmett.consumer.poll.empty": true } : {},
|
|
1258
|
-
...context.waitMs != null ? { "emmett.consumer.poll.wait_ms": context.waitMs } : {}
|
|
1259
|
-
});
|
|
1260
|
-
return fn(scope);
|
|
1261
|
-
});
|
|
1262
|
-
},
|
|
1263
|
-
recordPollMetrics: (durationMs, attrs) => {
|
|
1264
|
-
pollDuration.record(durationMs, attrs);
|
|
1265
|
-
},
|
|
1266
|
-
traceDelivery: (scope, processorId, fn) => {
|
|
1267
|
-
const start = Date.now();
|
|
1268
|
-
return scope.scope(`consumer.deliver.${processorId}`, async (child) => {
|
|
1269
|
-
try {
|
|
1270
|
-
return await fn();
|
|
1271
|
-
} catch (error) {
|
|
1272
|
-
if (error instanceof Error) child.recordException(error);
|
|
1273
|
-
throw error;
|
|
1274
|
-
} finally {
|
|
1275
|
-
deliveryDuration.record(Date.now() - start, { [A.consumer.delivery.processorId]: processorId });
|
|
1276
|
-
}
|
|
1277
|
-
}, { attributes: { [A.consumer.delivery.processorId]: processorId } });
|
|
1278
|
-
}
|
|
1279
|
-
};
|
|
1280
|
-
};
|
|
1281
|
-
|
|
1282
|
-
//#endregion
|
|
1283
|
-
//#region src/observability/collectors/workflowCollector.ts
|
|
1284
|
-
const workflowCollector = (observability) => {
|
|
1285
|
-
const { startScope } = ObservabilityScope({
|
|
1286
|
-
...observability,
|
|
1287
|
-
attributePrefix: "emmett"
|
|
1288
|
-
});
|
|
1289
|
-
const A = EmmettAttributes;
|
|
1290
|
-
const M = MessagingAttributes;
|
|
1291
|
-
const processingDuration = observability.meter.histogram(EmmettMetrics.workflow.processingDuration);
|
|
1292
|
-
return {
|
|
1293
|
-
startScope: (context, fn) => {
|
|
1294
|
-
const start = Date.now();
|
|
1295
|
-
return startScope("workflow.handle", async (scope) => {
|
|
1296
|
-
scope.setAttributes({
|
|
1297
|
-
[A.scope.type]: ScopeTypes.workflow,
|
|
1298
|
-
[A.workflow.id]: context.workflowId,
|
|
1299
|
-
[A.workflow.type]: context.workflowType,
|
|
1300
|
-
[A.workflow.inputType]: context.inputType,
|
|
1301
|
-
[M.system]: MessagingSystemName
|
|
1302
|
-
});
|
|
1303
|
-
let status = "success";
|
|
1304
|
-
try {
|
|
1305
|
-
return await fn(scope);
|
|
1306
|
-
} catch (err) {
|
|
1307
|
-
status = "failure";
|
|
1308
|
-
throw err;
|
|
1309
|
-
} finally {
|
|
1310
|
-
processingDuration.record(Date.now() - start, {
|
|
1311
|
-
[A.workflow.type]: context.workflowType,
|
|
1312
|
-
status
|
|
1313
|
-
});
|
|
1314
|
-
}
|
|
1315
|
-
}, { attributes: {
|
|
1316
|
-
[A.scope.type]: ScopeTypes.workflow,
|
|
1317
|
-
[A.workflow.type]: context.workflowType
|
|
1318
|
-
} });
|
|
1319
|
-
},
|
|
1320
|
-
recordOutputs: (scope, outputs) => {
|
|
1321
|
-
scope.setAttributes({
|
|
1322
|
-
[A.workflow.outputs]: outputs.map((o) => o.type),
|
|
1323
|
-
[A.workflow.outputsCount]: outputs.length
|
|
1324
|
-
});
|
|
1325
|
-
},
|
|
1326
|
-
recordStateRebuild: (scope, eventCount) => {
|
|
1327
|
-
scope.setAttributes({ [A.workflow.stateRebuildEventCount]: eventCount });
|
|
1328
|
-
}
|
|
1102
|
+
...options,
|
|
1103
|
+
observability
|
|
1329
1104
|
};
|
|
1330
1105
|
};
|
|
1331
1106
|
|
|
1332
|
-
//#endregion
|
|
1333
|
-
//#region src/processors/checkpoints.ts
|
|
1334
|
-
const ProcessorCheckpoint = (checkpoint) => checkpoint;
|
|
1335
|
-
const bigIntProcessorCheckpoint = (value) => bigInt.toNormalizedString(value);
|
|
1336
|
-
const parseBigIntProcessorCheckpoint = (value) => BigInt(value);
|
|
1337
|
-
const getCheckpoint = (message) => {
|
|
1338
|
-
return message.metadata.checkpoint;
|
|
1339
|
-
};
|
|
1340
|
-
|
|
1341
1107
|
//#endregion
|
|
1342
1108
|
//#region src/processors/observability/processorCollector.ts
|
|
1343
|
-
const
|
|
1109
|
+
const processorObservability = (options, parent) => ({
|
|
1344
1110
|
tracer: options?.observability?.tracer ?? parent?.observability?.tracer ?? noopTracer(),
|
|
1345
1111
|
meter: options?.observability?.meter ?? parent?.observability?.meter ?? noopMeter(),
|
|
1346
1112
|
propagation: options?.observability?.propagation ?? parent?.observability?.propagation ?? "links",
|
|
@@ -1448,9 +1214,10 @@ const defaultProcessorVersion = 1;
|
|
|
1448
1214
|
const defaultProcessorPartition = defaultTag;
|
|
1449
1215
|
const getProcessorInstanceId = (processorId) => `${processorId}:${v7()}`;
|
|
1450
1216
|
const getProjectorId = (options) => `emt:processor:projector:${options.projectionName}`;
|
|
1217
|
+
const { info, error } = LogEvent;
|
|
1451
1218
|
const reactor = (options) => {
|
|
1452
1219
|
const { checkpoints, processorId, processorInstanceId: instanceId = getProcessorInstanceId(processorId), type = MessageProcessorType.REACTOR, version = 1, partition = defaultProcessorPartition, hooks = {}, processingScope = defaultProcessingMessageProcessingScope, startFrom, canHandle, stopAfter } = options;
|
|
1453
|
-
const collector = processorCollector(
|
|
1220
|
+
const collector = processorCollector(processorObservability(options));
|
|
1454
1221
|
const isCustomBatch = "eachBatch" in options && !!options.eachBatch;
|
|
1455
1222
|
const eachBatch = isCustomBatch ? options.eachBatch : async (messages, context) => {
|
|
1456
1223
|
const batchCtx = context.observabilityScope.spanContext();
|
|
@@ -1532,25 +1299,27 @@ const reactor = (options) => {
|
|
|
1532
1299
|
...partialOptions,
|
|
1533
1300
|
observabilityScope: ("observabilityScope" in partialOptions ? partialOptions.observabilityScope ?? noopScope : noopScope) ?? noopScope
|
|
1534
1301
|
};
|
|
1302
|
+
const log = startOptions.observabilityScope.log;
|
|
1535
1303
|
if (isActive) {
|
|
1536
|
-
|
|
1304
|
+
log(info(`Processor ${processorId} with instance id ${instanceId} is already active. Start request ignored.`));
|
|
1537
1305
|
return;
|
|
1538
1306
|
}
|
|
1539
|
-
|
|
1307
|
+
log(info(`Starting processor ${processorId} with instance id ${instanceId}`));
|
|
1540
1308
|
await init(startOptions);
|
|
1541
1309
|
isActive = true;
|
|
1542
1310
|
closeSignal = onShutdown(() => close(startOptions));
|
|
1543
1311
|
if (lastCheckpoint !== null) {
|
|
1544
|
-
|
|
1312
|
+
log(info(`Processor ${processorId} started with instance id ${instanceId}, checkpoint: ${JSONSerializer.serialize(lastCheckpoint)}`));
|
|
1545
1313
|
return { lastCheckpoint };
|
|
1546
1314
|
}
|
|
1547
1315
|
return await processingScope(async (context) => {
|
|
1316
|
+
const log = context.observabilityScope.log;
|
|
1548
1317
|
if (hooks.onStart) {
|
|
1549
|
-
|
|
1318
|
+
log(info(`Executing onStart hook for processor ${processorId} with instance id ${instanceId}`));
|
|
1550
1319
|
await hooks.onStart(context);
|
|
1551
1320
|
}
|
|
1552
1321
|
if (startFrom && startFrom !== "CURRENT") {
|
|
1553
|
-
|
|
1322
|
+
log(info(`Processor ${processorId} with instance id ${instanceId} starting from: ${JSONSerializer.serialize(startFrom)}`));
|
|
1554
1323
|
return startFrom;
|
|
1555
1324
|
}
|
|
1556
1325
|
if (checkpoints) lastCheckpoint = (await checkpoints?.read({
|
|
@@ -1561,10 +1330,10 @@ const reactor = (options) => {
|
|
|
1561
1330
|
...context
|
|
1562
1331
|
})).lastCheckpoint;
|
|
1563
1332
|
if (lastCheckpoint === null) {
|
|
1564
|
-
|
|
1333
|
+
log(info(`Processor ${processorId} with instance id ${instanceId} starting from: BEGINNING`));
|
|
1565
1334
|
return "BEGINNING";
|
|
1566
1335
|
}
|
|
1567
|
-
|
|
1336
|
+
log(info(`Checkpoint read for processor ${processorId} with instance id ${instanceId}: ${JSONSerializer.serialize(lastCheckpoint)}`));
|
|
1568
1337
|
return { lastCheckpoint };
|
|
1569
1338
|
}, startOptions);
|
|
1570
1339
|
},
|
|
@@ -1621,12 +1390,12 @@ const reactor = (options) => {
|
|
|
1621
1390
|
...partialContext,
|
|
1622
1391
|
observabilityScope: scope
|
|
1623
1392
|
});
|
|
1624
|
-
} catch (
|
|
1625
|
-
|
|
1393
|
+
} catch (err) {
|
|
1394
|
+
scope.log(error({ err }, `Error during message processing for processor ${processorId} with instance id ${instanceId}. Stopping the processor.`));
|
|
1626
1395
|
isActive = false;
|
|
1627
1396
|
return {
|
|
1628
1397
|
type: "STOP",
|
|
1629
|
-
error,
|
|
1398
|
+
error: err,
|
|
1630
1399
|
reason: "Error during message processing"
|
|
1631
1400
|
};
|
|
1632
1401
|
}
|
|
@@ -2199,7 +1968,7 @@ const InMemoryProjectionSpec = { for: (options) => {
|
|
|
2199
1968
|
return Promise.resolve(false);
|
|
2200
1969
|
}
|
|
2201
1970
|
},
|
|
2202
|
-
observability:
|
|
1971
|
+
observability: eventStoreObservability(void 0)
|
|
2203
1972
|
});
|
|
2204
1973
|
};
|
|
2205
1974
|
return {
|
|
@@ -2304,6 +2073,88 @@ const upcastRecordedMessages = (recordedMessages, options) => {
|
|
|
2304
2073
|
return recordedMessages.map((recordedMessage) => upcastRecordedMessage(recordedMessage, options));
|
|
2305
2074
|
};
|
|
2306
2075
|
|
|
2076
|
+
//#endregion
|
|
2077
|
+
//#region src/eventStore/observability/eventStoreCollector.ts
|
|
2078
|
+
const eventStoreObservability = (options, parent) => ({
|
|
2079
|
+
tracer: options?.observability?.tracer ?? parent?.observability?.tracer ?? noopTracer(),
|
|
2080
|
+
meter: options?.observability?.meter ?? parent?.observability?.meter ?? noopMeter(),
|
|
2081
|
+
attributeTarget: options?.observability?.attributeTarget ?? parent?.observability?.attributeTarget ?? "both"
|
|
2082
|
+
});
|
|
2083
|
+
const eventStoreCollector = (observability) => {
|
|
2084
|
+
const A = EmmettAttributes;
|
|
2085
|
+
const M = MessagingAttributes;
|
|
2086
|
+
const streamReadingDuration = observability.meter.histogram(EmmettMetrics.stream.readingDuration);
|
|
2087
|
+
const streamReadingSize = observability.meter.histogram(EmmettMetrics.stream.readingSize);
|
|
2088
|
+
const eventReadingCount = observability.meter.counter(EmmettMetrics.event.readingCount);
|
|
2089
|
+
const streamAppendingDuration = observability.meter.histogram(EmmettMetrics.stream.appendingDuration);
|
|
2090
|
+
const streamAppendingSize = observability.meter.histogram(EmmettMetrics.stream.appendingSize);
|
|
2091
|
+
const eventAppendingCount = observability.meter.counter(EmmettMetrics.event.appendingCount);
|
|
2092
|
+
return {
|
|
2093
|
+
instrumentRead: (streamName, fn) => {
|
|
2094
|
+
const start = Date.now();
|
|
2095
|
+
return observability.tracer.startSpan("eventStore.readStream", async (span) => {
|
|
2096
|
+
span.setAttributes({
|
|
2097
|
+
[A.eventStore.operation]: "readStream",
|
|
2098
|
+
[A.stream.name]: streamName,
|
|
2099
|
+
[M.operation.type]: "receive",
|
|
2100
|
+
[M.destination.name]: streamName,
|
|
2101
|
+
[M.system]: MessagingSystemName
|
|
2102
|
+
});
|
|
2103
|
+
let status = "success";
|
|
2104
|
+
try {
|
|
2105
|
+
const result = await fn();
|
|
2106
|
+
const events = result.events;
|
|
2107
|
+
span.setAttributes({
|
|
2108
|
+
[A.eventStore.read.status]: status,
|
|
2109
|
+
[A.eventStore.read.eventCount]: events.length,
|
|
2110
|
+
[A.eventStore.read.eventTypes]: [...new Set(events.map((e) => e.type))]
|
|
2111
|
+
});
|
|
2112
|
+
streamReadingSize.record(events.length, { [A.eventStore.read.status]: status });
|
|
2113
|
+
for (const event of events) eventReadingCount.add(1, { [A.event.type]: event.type });
|
|
2114
|
+
return result;
|
|
2115
|
+
} catch (err) {
|
|
2116
|
+
status = "failure";
|
|
2117
|
+
span.setAttributes({ [A.eventStore.read.status]: status });
|
|
2118
|
+
throw err;
|
|
2119
|
+
} finally {
|
|
2120
|
+
streamReadingDuration.record(Date.now() - start, { [A.eventStore.read.status]: status });
|
|
2121
|
+
}
|
|
2122
|
+
});
|
|
2123
|
+
},
|
|
2124
|
+
instrumentAppend: (streamName, events, fn) => {
|
|
2125
|
+
const start = Date.now();
|
|
2126
|
+
return observability.tracer.startSpan("eventStore.appendToStream", async (span) => {
|
|
2127
|
+
span.setAttributes({
|
|
2128
|
+
[A.eventStore.operation]: "appendToStream",
|
|
2129
|
+
[A.stream.name]: streamName,
|
|
2130
|
+
[A.eventStore.append.batchSize]: events.length,
|
|
2131
|
+
[M.operation.type]: "send",
|
|
2132
|
+
[M.batch.messageCount]: events.length,
|
|
2133
|
+
[M.destination.name]: streamName,
|
|
2134
|
+
[M.system]: MessagingSystemName
|
|
2135
|
+
});
|
|
2136
|
+
let status = "success";
|
|
2137
|
+
try {
|
|
2138
|
+
const result = await fn();
|
|
2139
|
+
span.setAttributes({
|
|
2140
|
+
[A.eventStore.append.status]: status,
|
|
2141
|
+
[A.stream.versionAfter]: Number(result.nextExpectedStreamVersion)
|
|
2142
|
+
});
|
|
2143
|
+
streamAppendingSize.record(events.length, { [A.eventStore.append.status]: status });
|
|
2144
|
+
for (const event of events) eventAppendingCount.add(1, { [A.event.type]: event.type });
|
|
2145
|
+
return result;
|
|
2146
|
+
} catch (err) {
|
|
2147
|
+
status = "failure";
|
|
2148
|
+
span.setAttributes({ [A.eventStore.append.status]: status });
|
|
2149
|
+
throw err;
|
|
2150
|
+
} finally {
|
|
2151
|
+
streamAppendingDuration.record(Date.now() - start, { [A.eventStore.append.status]: status });
|
|
2152
|
+
}
|
|
2153
|
+
});
|
|
2154
|
+
}
|
|
2155
|
+
};
|
|
2156
|
+
};
|
|
2157
|
+
|
|
2307
2158
|
//#endregion
|
|
2308
2159
|
//#region src/eventStore/inMemoryEventStore.ts
|
|
2309
2160
|
const InMemoryEventStoreDefaultStreamVersion = 0n;
|
|
@@ -2314,7 +2165,7 @@ const getInMemoryEventStore = (eventStoreOptions) => {
|
|
|
2314
2165
|
};
|
|
2315
2166
|
const database = eventStoreOptions?.database || getInMemoryDatabase();
|
|
2316
2167
|
const inlineProjections = (eventStoreOptions?.projections ?? []).filter(({ type }) => type === "inline").map(({ projection }) => projection);
|
|
2317
|
-
const observability =
|
|
2168
|
+
const observability = eventStoreObservability(eventStoreOptions);
|
|
2318
2169
|
const collector = eventStoreCollector(observability);
|
|
2319
2170
|
const eventStore = {
|
|
2320
2171
|
database,
|
|
@@ -2396,7 +2247,7 @@ const getInMemoryEventStore = (eventStoreOptions) => {
|
|
|
2396
2247
|
|
|
2397
2248
|
//#endregion
|
|
2398
2249
|
//#region src/commandHandling/observability/commandHandlerCollector.ts
|
|
2399
|
-
const
|
|
2250
|
+
const commandObservability = (options, parent) => ({
|
|
2400
2251
|
tracer: options?.observability?.tracer ?? parent?.observability?.tracer ?? noopTracer(),
|
|
2401
2252
|
meter: options?.observability?.meter ?? parent?.observability?.meter ?? noopMeter(),
|
|
2402
2253
|
attributeTarget: options?.observability?.attributeTarget ?? parent?.observability?.attributeTarget ?? "both",
|
|
@@ -2440,7 +2291,7 @@ const commandHandlerCollector = (observability) => {
|
|
|
2440
2291
|
"exception.message": err instanceof Error ? err.message : String(err),
|
|
2441
2292
|
"exception.type": err instanceof Error ? err.constructor.name : "unknown"
|
|
2442
2293
|
});
|
|
2443
|
-
scope.
|
|
2294
|
+
scope.log(LogEvent.error(err instanceof Error ? err : new Error(String(err))));
|
|
2444
2295
|
throw err;
|
|
2445
2296
|
} finally {
|
|
2446
2297
|
commandHandlingDuration.record(Date.now() - start, {
|
|
@@ -2489,7 +2340,7 @@ const CommandHandlerStreamVersionConflictRetryOptions = {
|
|
|
2489
2340
|
shouldRetryError: isExpectedVersionConflictError
|
|
2490
2341
|
};
|
|
2491
2342
|
const CommandHandler = (options) => async (store, id, handle, handleOptions) => {
|
|
2492
|
-
const collector = commandHandlerCollector(
|
|
2343
|
+
const collector = commandHandlerCollector(commandObservability(options));
|
|
2493
2344
|
const streamName = (options.mapToStreamId ?? ((id) => id))(id);
|
|
2494
2345
|
const commandType = handleOptions?.commandType ?? options.commandType ?? options.name ?? handlerNames(handle);
|
|
2495
2346
|
const correlationId = handleOptions?.observability?.correlationId ?? v7();
|
|
@@ -2588,6 +2439,61 @@ const DeciderCommandHandler = (options) => async (eventStore, id, commands, hand
|
|
|
2588
2439
|
});
|
|
2589
2440
|
};
|
|
2590
2441
|
|
|
2442
|
+
//#endregion
|
|
2443
|
+
//#region src/consumers/observability/consumerCollector.ts
|
|
2444
|
+
const consumerObservability = (options, parent) => {
|
|
2445
|
+
const observability = mergeObservabilityOptions({ observability: options?.observability }, parent?.observability).observability;
|
|
2446
|
+
return {
|
|
2447
|
+
tracer: observability?.tracer ?? noopTracer(),
|
|
2448
|
+
meter: observability?.meter ?? noopMeter(),
|
|
2449
|
+
pollTracing: observability?.pollTracing ?? "off",
|
|
2450
|
+
attributeTarget: observability?.attributeTarget ?? "both"
|
|
2451
|
+
};
|
|
2452
|
+
};
|
|
2453
|
+
const consumerCollector = (observability) => {
|
|
2454
|
+
const { startScope } = ObservabilityScope({
|
|
2455
|
+
...observability,
|
|
2456
|
+
attributePrefix: "emmett"
|
|
2457
|
+
});
|
|
2458
|
+
const A = EmmettAttributes;
|
|
2459
|
+
const M = MessagingAttributes;
|
|
2460
|
+
const pollDuration = observability.meter.histogram(EmmettMetrics.consumer.pollDuration);
|
|
2461
|
+
const deliveryDuration = observability.meter.histogram(EmmettMetrics.consumer.deliveryDuration);
|
|
2462
|
+
return {
|
|
2463
|
+
tracePoll: (context, fn) => {
|
|
2464
|
+
if (observability.pollTracing === "off" || observability.pollTracing === "active" && context.batchSize === 0) return fn(noopScope);
|
|
2465
|
+
return startScope("consumer.poll", async (scope) => {
|
|
2466
|
+
scope.setAttributes({
|
|
2467
|
+
[A.scope.type]: ScopeTypes.consumer,
|
|
2468
|
+
[A.consumer.batchSize]: context.batchSize,
|
|
2469
|
+
[A.consumer.processorCount]: context.processorCount,
|
|
2470
|
+
[M.system]: MessagingSystemName,
|
|
2471
|
+
[M.operation.type]: "receive",
|
|
2472
|
+
...context.empty ? { "emmett.consumer.poll.empty": true } : {},
|
|
2473
|
+
...context.waitMs != null ? { "emmett.consumer.poll.wait_ms": context.waitMs } : {}
|
|
2474
|
+
});
|
|
2475
|
+
return fn(scope);
|
|
2476
|
+
});
|
|
2477
|
+
},
|
|
2478
|
+
recordPollMetrics: (durationMs, attrs) => {
|
|
2479
|
+
pollDuration.record(durationMs, attrs);
|
|
2480
|
+
},
|
|
2481
|
+
traceDelivery: (scope, processorId, fn) => {
|
|
2482
|
+
const start = Date.now();
|
|
2483
|
+
return scope.scope(`consumer.deliver.${processorId}`, async (child) => {
|
|
2484
|
+
try {
|
|
2485
|
+
return await fn();
|
|
2486
|
+
} catch (error) {
|
|
2487
|
+
if (error instanceof Error) child.log(LogEvent.error(error));
|
|
2488
|
+
throw error;
|
|
2489
|
+
} finally {
|
|
2490
|
+
deliveryDuration.record(Date.now() - start, { [A.consumer.delivery.processorId]: processorId });
|
|
2491
|
+
}
|
|
2492
|
+
}, { attributes: { [A.consumer.delivery.processorId]: processorId } });
|
|
2493
|
+
}
|
|
2494
|
+
};
|
|
2495
|
+
};
|
|
2496
|
+
|
|
2591
2497
|
//#endregion
|
|
2592
2498
|
//#region src/messageBus/index.ts
|
|
2593
2499
|
const getInMemoryMessageBus = () => {
|
|
@@ -2654,6 +2560,66 @@ const projections = {
|
|
|
2654
2560
|
async: asyncProjections
|
|
2655
2561
|
};
|
|
2656
2562
|
|
|
2563
|
+
//#endregion
|
|
2564
|
+
//#region src/workflows/observability/workflowCollector.ts
|
|
2565
|
+
const workflowObservability = (options, parent) => {
|
|
2566
|
+
const observability = mergeObservabilityOptions({ observability: options?.observability }, parent?.observability).observability;
|
|
2567
|
+
return {
|
|
2568
|
+
tracer: observability?.tracer ?? noopTracer(),
|
|
2569
|
+
meter: observability?.meter ?? noopMeter(),
|
|
2570
|
+
propagation: observability?.propagation ?? "links",
|
|
2571
|
+
attributeTarget: observability?.attributeTarget ?? "both",
|
|
2572
|
+
includeMessagePayloads: observability?.includeMessagePayloads ?? false
|
|
2573
|
+
};
|
|
2574
|
+
};
|
|
2575
|
+
const workflowCollector = (observability) => {
|
|
2576
|
+
const { startScope } = ObservabilityScope({
|
|
2577
|
+
...observability,
|
|
2578
|
+
attributePrefix: "emmett"
|
|
2579
|
+
});
|
|
2580
|
+
const A = EmmettAttributes;
|
|
2581
|
+
const M = MessagingAttributes;
|
|
2582
|
+
const processingDuration = observability.meter.histogram(EmmettMetrics.workflow.processingDuration);
|
|
2583
|
+
return {
|
|
2584
|
+
startScope: (context, fn) => {
|
|
2585
|
+
const start = Date.now();
|
|
2586
|
+
return startScope("workflow.handle", async (scope) => {
|
|
2587
|
+
scope.setAttributes({
|
|
2588
|
+
[A.scope.type]: ScopeTypes.workflow,
|
|
2589
|
+
[A.workflow.id]: context.workflowId,
|
|
2590
|
+
[A.workflow.type]: context.workflowType,
|
|
2591
|
+
[A.workflow.inputType]: context.inputType,
|
|
2592
|
+
[M.system]: MessagingSystemName
|
|
2593
|
+
});
|
|
2594
|
+
let status = "success";
|
|
2595
|
+
try {
|
|
2596
|
+
return await fn(scope);
|
|
2597
|
+
} catch (err) {
|
|
2598
|
+
status = "failure";
|
|
2599
|
+
throw err;
|
|
2600
|
+
} finally {
|
|
2601
|
+
processingDuration.record(Date.now() - start, {
|
|
2602
|
+
[A.workflow.type]: context.workflowType,
|
|
2603
|
+
status
|
|
2604
|
+
});
|
|
2605
|
+
}
|
|
2606
|
+
}, { attributes: {
|
|
2607
|
+
[A.scope.type]: ScopeTypes.workflow,
|
|
2608
|
+
[A.workflow.type]: context.workflowType
|
|
2609
|
+
} });
|
|
2610
|
+
},
|
|
2611
|
+
recordOutputs: (scope, outputs) => {
|
|
2612
|
+
scope.setAttributes({
|
|
2613
|
+
[A.workflow.outputs]: outputs.map((o) => o.type),
|
|
2614
|
+
[A.workflow.outputsCount]: outputs.length
|
|
2615
|
+
});
|
|
2616
|
+
},
|
|
2617
|
+
recordStateRebuild: (scope, eventCount) => {
|
|
2618
|
+
scope.setAttributes({ [A.workflow.stateRebuildEventCount]: eventCount });
|
|
2619
|
+
}
|
|
2620
|
+
};
|
|
2621
|
+
};
|
|
2622
|
+
|
|
2657
2623
|
//#endregion
|
|
2658
2624
|
//#region src/workflows/handleWorkflow.ts
|
|
2659
2625
|
const WorkflowHandlerStreamVersionConflictRetryOptions = {
|
|
@@ -2723,7 +2689,7 @@ const createWrappedEvolve = (evolve, workflowName, separateInputInboxFromProcess
|
|
|
2723
2689
|
};
|
|
2724
2690
|
const workflowStreamName = ({ workflowName, workflowId }) => `emt:workflow:${workflowName}:${workflowId}`;
|
|
2725
2691
|
const WorkflowHandler = (options) => async (store, message, handleOptions) => {
|
|
2726
|
-
const collector = workflowCollector(
|
|
2692
|
+
const collector = workflowCollector(workflowObservability(options));
|
|
2727
2693
|
const workflowType = options.workflow.name;
|
|
2728
2694
|
const inputType = message.type;
|
|
2729
2695
|
const workflowId = options.getWorkflowId(message) ?? "";
|
|
@@ -2909,8 +2875,6 @@ var src_exports = /* @__PURE__ */ __exportAll({
|
|
|
2909
2875
|
JSONReviver: () => JSONReviver,
|
|
2910
2876
|
JSONRevivers: () => JSONRevivers,
|
|
2911
2877
|
JSONSerializer: () => JSONSerializer,
|
|
2912
|
-
LogLevel: () => LogLevel,
|
|
2913
|
-
LogStyle: () => LogStyle,
|
|
2914
2878
|
MessageProcessor: () => MessageProcessor,
|
|
2915
2879
|
MessageProcessorType: () => MessageProcessorType,
|
|
2916
2880
|
MessagingSystemName: () => MessagingSystemName,
|
|
@@ -2966,6 +2930,7 @@ var src_exports = /* @__PURE__ */ __exportAll({
|
|
|
2966
2930
|
composeJSONReplacers: () => composeJSONReplacers,
|
|
2967
2931
|
composeJSONRevivers: () => composeJSONRevivers,
|
|
2968
2932
|
consumerCollector: () => consumerCollector,
|
|
2933
|
+
consumerObservability: () => consumerObservability,
|
|
2969
2934
|
deepEquals: () => deepEquals,
|
|
2970
2935
|
defaultProcessingMessageProcessingScope: () => defaultProcessingMessageProcessingScope,
|
|
2971
2936
|
defaultProcessorPartition: () => defaultProcessorPartition,
|
|
@@ -2976,9 +2941,11 @@ var src_exports = /* @__PURE__ */ __exportAll({
|
|
|
2976
2941
|
downcastRecordedMessage: () => downcastRecordedMessage,
|
|
2977
2942
|
downcastRecordedMessages: () => downcastRecordedMessages,
|
|
2978
2943
|
emmettPrefix: () => "emt",
|
|
2944
|
+
errorReplacer: () => errorReplacer,
|
|
2979
2945
|
event: () => event,
|
|
2980
2946
|
eventInStream: () => eventInStream,
|
|
2981
2947
|
eventStoreCollector: () => eventStoreCollector,
|
|
2948
|
+
eventStoreObservability: () => eventStoreObservability,
|
|
2982
2949
|
eventsInStream: () => eventsInStream,
|
|
2983
2950
|
expectInMemoryDocuments: () => expectInMemoryDocuments,
|
|
2984
2951
|
filterProjections: () => filterProjections,
|
|
@@ -3020,6 +2987,7 @@ var src_exports = /* @__PURE__ */ __exportAll({
|
|
|
3020
2987
|
jsonSerializer: () => jsonSerializer,
|
|
3021
2988
|
matchesExpectedVersion: () => matchesExpectedVersion,
|
|
3022
2989
|
merge: () => merge,
|
|
2990
|
+
mergeObservabilityOptions: () => mergeObservabilityOptions,
|
|
3023
2991
|
message: () => message,
|
|
3024
2992
|
newEventsInStream: () => newEventsInStream,
|
|
3025
2993
|
nulloSessionFactory: () => nulloSessionFactory,
|
|
@@ -3027,18 +2995,14 @@ var src_exports = /* @__PURE__ */ __exportAll({
|
|
|
3027
2995
|
parseBigIntProcessorCheckpoint: () => parseBigIntProcessorCheckpoint,
|
|
3028
2996
|
parseDateFromUtcYYYYMMDD: () => parseDateFromUtcYYYYMMDD,
|
|
3029
2997
|
processorCollector: () => processorCollector,
|
|
2998
|
+
processorObservability: () => processorObservability,
|
|
3030
2999
|
projection: () => projection,
|
|
3031
3000
|
projections: () => projections,
|
|
3032
3001
|
projector: () => projector,
|
|
3033
3002
|
reactor: () => reactor,
|
|
3034
3003
|
reduceAsync: () => reduceAsync,
|
|
3035
|
-
resolveConsumerObservability: () => resolveConsumerObservability,
|
|
3036
|
-
resolveEventStoreObservability: () => resolveEventStoreObservability,
|
|
3037
|
-
resolveProcessorObservability: () => resolveProcessorObservability,
|
|
3038
|
-
resolveWorkflowObservability: () => resolveWorkflowObservability,
|
|
3039
3004
|
sum: () => sum,
|
|
3040
3005
|
toNormalizedString: () => toNormalizedString,
|
|
3041
|
-
tracer: () => tracer,
|
|
3042
3006
|
tryPublishMessagesAfterCommit: () => tryPublishMessagesAfterCommit,
|
|
3043
3007
|
unknownTag: () => unknownTag,
|
|
3044
3008
|
upcastRecordedMessage: () => upcastRecordedMessage,
|
|
@@ -3046,11 +3010,12 @@ var src_exports = /* @__PURE__ */ __exportAll({
|
|
|
3046
3010
|
verifyThat: () => verifyThat,
|
|
3047
3011
|
wasMessageHandled: () => wasMessageHandled,
|
|
3048
3012
|
workflowCollector: () => workflowCollector,
|
|
3013
|
+
workflowObservability: () => workflowObservability,
|
|
3049
3014
|
workflowOutputHandler: () => workflowOutputHandler,
|
|
3050
3015
|
workflowProcessor: () => workflowProcessor,
|
|
3051
3016
|
workflowStreamName: () => workflowStreamName
|
|
3052
3017
|
});
|
|
3053
3018
|
|
|
3054
3019
|
//#endregion
|
|
3055
|
-
export { AssertionError, CommandHandler, CommandHandlerStreamVersionConflictRetryOptions, ConcurrencyError, ConcurrencyInMemoryDatabaseError, DATABASE_REQUIRED_ERROR_MESSAGE, DeciderCommandHandler, DeciderSpecification, EmmettAttributes, EmmettError, EmmettMetrics, ExpectedVersionConflictError, GlobalStreamCaughtUpType, IllegalStateError, InMemoryEventStoreDefaultStreamVersion, InMemoryProjectionSpec, InProcessLock, JSONCodec, JSONReplacer, JSONReplacers, JSONReviver, JSONRevivers, JSONSerializer,
|
|
3020
|
+
export { AssertionError, CommandHandler, CommandHandlerStreamVersionConflictRetryOptions, ConcurrencyError, ConcurrencyInMemoryDatabaseError, DATABASE_REQUIRED_ERROR_MESSAGE, DeciderCommandHandler, DeciderSpecification, EmmettAttributes, EmmettError, EmmettMetrics, ExpectedVersionConflictError, GlobalStreamCaughtUpType, IllegalStateError, InMemoryEventStoreDefaultStreamVersion, InMemoryProjectionSpec, InProcessLock, JSONCodec, JSONReplacer, JSONReplacers, JSONReviver, JSONRevivers, JSONSerializer, MessageProcessor, MessageProcessorType, MessagingSystemName, NO_CONCURRENCY_CHECK, NoRetries, NotFoundError, ProcessorCheckpoint, STREAM_DOES_NOT_EXIST, STREAM_EXISTS, ScopeTypes, TaskProcessor, ValidationError, ValidationErrors, Workflow, WorkflowHandler, WorkflowHandlerStreamVersionConflictRetryOptions, WorkflowSpecification, WrapEventStore, argMatches, argValue, arrayUtils, assertDeepEqual, assertDefined, assertDoesNotThrow, assertEqual, assertExpectedVersionMatchesCurrent, assertFails, assertFalse, assertIsNotNull, assertIsNull, assertMatches, assertNotDeepEqual, assertNotEmptyString, assertNotEqual, assertOk, assertPositiveNumber, assertRejects, assertThat, assertThatArray, assertThrows, assertThrowsAsync, assertTrue, assertUndefined, assertUnsignedBigInt, asyncAwaiter, asyncProjections, asyncRetry, bigInt, bigIntProcessorCheckpoint, canCreateEventStoreSession, caughtUpEventFrom, command, composeJSONReplacers, composeJSONRevivers, consumerCollector, consumerObservability, deepEquals, defaultProcessingMessageProcessingScope, defaultProcessorPartition, defaultProcessorVersion, defaultTag, delay, documentExists, downcastRecordedMessage, downcastRecordedMessages, emmettPrefix, errorReplacer, event, eventInStream, eventStoreCollector, eventStoreObservability, eventsInStream, expectInMemoryDocuments, filterProjections, formatDateToUtcYYYYMMDD, forwardToMessageBus, getCheckpoint, getInMemoryDatabase, getInMemoryEventStore, getInMemoryMessageBus, getProcessorInstanceId, getProjectorId, getWorkflowId, globalStreamCaughtUp, globalTag, guardBoundedAccess, guardExclusiveAccess, guardInitializedOnce, handleInMemoryProjections, hashText, inMemoryCheckpointer, inMemoryMultiStreamProjection, inMemoryProjection, inMemoryProjector, inMemoryReactor, inMemorySingleStreamProjection, inlineProjections, isBigint, isEquatable, isErrorConstructor, isExpectedVersionConflictError, isGlobalStreamCaughtUp, isNotInternalEvent, isNumber, isPluginConfig, isString, isSubscriptionEvent, isSubset, isValidYYYYMMDD, jsonSerializer, matchesExpectedVersion, merge, mergeObservabilityOptions, message, newEventsInStream, nulloSessionFactory, onShutdown, parseBigIntProcessorCheckpoint, parseDateFromUtcYYYYMMDD, processorCollector, processorObservability, projection, projections, projector, reactor, reduceAsync, sum, toNormalizedString, tryPublishMessagesAfterCommit, unknownTag, upcastRecordedMessage, upcastRecordedMessages, verifyThat, wasMessageHandled, workflowCollector, workflowObservability, workflowOutputHandler, workflowProcessor, workflowStreamName };
|
|
3056
3021
|
//# sourceMappingURL=index.js.map
|