@cap-js-community/event-queue 1.9.0-beta.0 → 1.9.0-beta.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/package.json +1 -1
- package/src/config.js +2 -2
- package/src/shared/openTelemetry.js +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cap-js-community/event-queue",
|
|
3
|
-
"version": "1.9.0-beta.
|
|
3
|
+
"version": "1.9.0-beta.1",
|
|
4
4
|
"description": "An event queue that enables secure transactional processing of asynchronous and periodic events, featuring instant event processing with Redis Pub/Sub and load distribution across all application instances.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
package/src/config.js
CHANGED
|
@@ -18,7 +18,7 @@ const MIN_INTERVAL_SEC = 10;
|
|
|
18
18
|
const DEFAULT_LOAD = 1;
|
|
19
19
|
const DEFAULT_PRIORITY = Priorities.Medium;
|
|
20
20
|
const DEFAULT_INCREASE_PRIORITY = true;
|
|
21
|
-
const
|
|
21
|
+
const DEFAULT_KEEP_ALIVE_INTERVAL = 60;
|
|
22
22
|
const DEFAULT_MAX_FACTOR_STUCK_2_KEEP_ALIVE_INTERVAL = 3.5;
|
|
23
23
|
const SUFFIX_PERIODIC = "_PERIODIC";
|
|
24
24
|
const COMMAND_BLOCK = "EVENT_QUEUE_EVENT_BLOCK";
|
|
@@ -386,7 +386,7 @@ class Config {
|
|
|
386
386
|
event.load = event.load ?? DEFAULT_LOAD;
|
|
387
387
|
event.priority = event.priority ?? DEFAULT_PRIORITY;
|
|
388
388
|
event.increasePriorityOverTime = event.increasePriorityOverTime ?? DEFAULT_INCREASE_PRIORITY;
|
|
389
|
-
event.keepAliveInterval = (event.keepAliveInterval ??
|
|
389
|
+
event.keepAliveInterval = (event.keepAliveInterval ?? DEFAULT_KEEP_ALIVE_INTERVAL) * 1000;
|
|
390
390
|
event.keepAliveMaxInProgressTime = event.keepAliveInterval * DEFAULT_MAX_FACTOR_STUCK_2_KEEP_ALIVE_INTERVAL;
|
|
391
391
|
}
|
|
392
392
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const cds = require("@sap/cds");
|
|
4
|
-
let otel;
|
|
4
|
+
let otel, telemetry;
|
|
5
5
|
try {
|
|
6
|
+
telemetry = require("@cap-js/telemetry");
|
|
6
7
|
otel = require("@opentelemetry/api");
|
|
7
8
|
} catch {
|
|
8
9
|
// ignore
|
|
@@ -13,11 +14,13 @@ const config = require("../config");
|
|
|
13
14
|
const COMPONENT_NAME = "/shared/openTelemetry";
|
|
14
15
|
|
|
15
16
|
const trace = async (context, label, fn, { attributes = {}, newRootSpan = false } = {}) => {
|
|
16
|
-
if (!config.enableCAPTelemetry || !otel || !
|
|
17
|
+
if (!config.enableCAPTelemetry || !otel || !telemetry) {
|
|
17
18
|
return fn();
|
|
18
19
|
}
|
|
19
20
|
|
|
20
|
-
const
|
|
21
|
+
const tracer = otel.trace.getTracer("eventqueue");
|
|
22
|
+
|
|
23
|
+
const span = tracer.startSpan(`eventqueue-${label}`, {
|
|
21
24
|
kind: otel.SpanKind.INTERNAL,
|
|
22
25
|
root: newRootSpan,
|
|
23
26
|
});
|