@zintrust/queue-monitor 2.4.3 → 2.4.4

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.
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@zintrust/queue-monitor",
3
- "version": "2.4.1",
4
- "buildDate": "2026-05-31T11:37:21.551Z",
3
+ "version": "2.4.3",
4
+ "buildDate": "2026-06-01T13:35:49.849Z",
5
5
  "buildEnvironment": {
6
6
  "node": "v22.22.1",
7
7
  "platform": "darwin",
8
8
  "arch": "arm64"
9
9
  },
10
10
  "git": {
11
- "commit": "e97b7b3d",
11
+ "commit": "98a0caf4",
12
12
  "branch": "release"
13
13
  },
14
14
  "package": {
@@ -34,16 +34,16 @@
34
34
  "sha256": "33e57f6cec15b8dcb5886ca92644139d2e3ca1789aae1c3a4a066d75a273a6bb"
35
35
  },
36
36
  "QueueMonitoringService.d.ts": {
37
- "size": 1698,
38
- "sha256": "fcd19d80f3fc77b1318594bf45f13afed54febc4334d3aa6be975d3fe3bb73f2"
37
+ "size": 1760,
38
+ "sha256": "949569e78120329804b63736b25c8cff9b5516ca44c9e7f1b2989d9cb09360b9"
39
39
  },
40
40
  "QueueMonitoringService.js": {
41
- "size": 8935,
42
- "sha256": "c099e8922dd5642bce33a7db4b4a98641cab16e45a4ab76f989ef76a1178700e"
41
+ "size": 10048,
42
+ "sha256": "3b7e85e6a0ba5dd958010bdf023052b1fb66cfbb52047554b326b4465b817719"
43
43
  },
44
44
  "build-manifest.json": {
45
- "size": 3730,
46
- "sha256": "f8860c23ea4936ad934d716cd6c818a959056530306a18d2dbe017cd25ef8044"
45
+ "size": 3869,
46
+ "sha256": "c1ba9522a69a44edce77119e8fd9df36dff9e8797d8a040448a8659da8b0721c"
47
47
  },
48
48
  "connection.d.ts": {
49
49
  "size": 287,
@@ -78,20 +78,20 @@
78
78
  "sha256": "fb91df973acd13a88cca443e50ecdd34944c66e1a1d48333f63099079a00f3c9"
79
79
  },
80
80
  "driver.d.ts": {
81
- "size": 1236,
82
- "sha256": "91f705031e1abd9049e93c49a2cdd00552f41c4693f2f79fb3fbeeb6c67ac85a"
81
+ "size": 1782,
82
+ "sha256": "a1629f48367efab3c0031ace21c5304821d01ca1d7027cc7a50b62570339c848"
83
83
  },
84
84
  "driver.js": {
85
- "size": 9763,
86
- "sha256": "3f12f43c1b67091588dfcbbed70d39d046f88e4699db4c1cf4ee6f442b5b87dd"
85
+ "size": 12473,
86
+ "sha256": "162ee0db3fe8a0cbc6378133a22d6df723a900e08ea74817c562b830a88338db"
87
87
  },
88
88
  "index.d.ts": {
89
89
  "size": 2344,
90
90
  "sha256": "370b578ca6412fbdbb2f6966c0899a4c9d6d1ab08defe48a9004564124b1f45e"
91
91
  },
92
92
  "index.js": {
93
- "size": 16079,
94
- "sha256": "4e6d97afc428b9f3438be08711c79ea66711038a8d93c28e7074754a8b35ba4d"
93
+ "size": 17226,
94
+ "sha256": "79f16f77f5e56c815212ffc43718fee07cf490c4f7fd9ff0e68fa656337b8a76"
95
95
  },
96
96
  "metrics-index.d.ts": {
97
97
  "size": 239,
@@ -114,8 +114,8 @@
114
114
  "sha256": "b4608f964f6c5cdb5469eb320683fee827734adcf1d03ea931766405451f35df"
115
115
  },
116
116
  "runtime-index.js": {
117
- "size": 8924,
118
- "sha256": "494757d540fe57507ac59ef2935ad683cb14fa57dbe188ffe3e6dd9fe3cb1ea9"
117
+ "size": 9948,
118
+ "sha256": "7aa5c97aef19ec36e1309b9abc922481924672e4017bc3fe198b5eff7dabda86"
119
119
  },
120
120
  "worker.d.ts": {
121
121
  "size": 338,
package/dist/driver.d.ts CHANGED
@@ -2,6 +2,20 @@ import type { Job, JobsOptions } from 'bullmq';
2
2
  import { type RedisConfig } from './connection.js';
3
3
  export type JobPayload<T = unknown> = T;
4
4
  export type JobCounts = Record<string, number>;
5
+ /**
6
+ * Standard BullMQ job-count buckets, all zero. Used when the backing store is
7
+ * unavailable so a queue is still listed (with empty counts) instead of being
8
+ * dropped from the snapshot entirely.
9
+ */
10
+ export declare const emptyCounts: () => JobCounts;
11
+ /**
12
+ * Map a list of known queue names to entries with empty counts. Keeps the
13
+ * dashboard showing the configured queues during transient backend outages.
14
+ */
15
+ export declare const emptyQueueStats: (queueNames: ReadonlyArray<string>) => Array<{
16
+ name: string;
17
+ counts: JobCounts;
18
+ }>;
5
19
  export type RetrySnapshot = {
6
20
  name?: string;
7
21
  data: unknown;
package/dist/driver.js CHANGED
@@ -4,6 +4,24 @@ import { Logger } from '@zintrust/core/logger';
4
4
  import { getBullMQSafeQueueName } from '@zintrust/core/redis';
5
5
  import { Queue } from 'bullmq';
6
6
  import { createRedisConnection } from './connection.js';
7
+ /**
8
+ * Standard BullMQ job-count buckets, all zero. Used when the backing store is
9
+ * unavailable so a queue is still listed (with empty counts) instead of being
10
+ * dropped from the snapshot entirely.
11
+ */
12
+ export const emptyCounts = () => ({
13
+ waiting: 0,
14
+ active: 0,
15
+ completed: 0,
16
+ failed: 0,
17
+ delayed: 0,
18
+ paused: 0,
19
+ });
20
+ /**
21
+ * Map a list of known queue names to entries with empty counts. Keeps the
22
+ * dashboard showing the configured queues during transient backend outages.
23
+ */
24
+ export const emptyQueueStats = (queueNames) => queueNames.map((name) => ({ name, counts: emptyCounts() }));
7
25
  const shouldUseRedisRpcMonitorDriver = () => Env.USE_REDIS_PROXY === true && Env.get('REDIS_RPC_URL', '').trim() !== '';
8
26
  const resolveRpcBaseUrl = () => {
9
27
  const configured = Env.get('REDIS_RPC_URL', '').trim();
@@ -86,11 +104,11 @@ const createRedisRpcDriver = () => {
86
104
  const client = await createRpcClient();
87
105
  try {
88
106
  const snapshot = await client.monitor('getSnapshot', { args: [queueNames] });
89
- return snapshot.queues ?? [];
107
+ return snapshot.queues ?? emptyQueueStats(queueNames);
90
108
  }
91
109
  catch (error) {
92
- Logger.warn('[queue-monitor] Redis RPC batch counts failed; returning no queues', error);
93
- return [];
110
+ Logger.warn('[queue-monitor] Redis RPC batch counts failed; returning known queues with empty counts', error);
111
+ return emptyQueueStats(queueNames);
94
112
  }
95
113
  },
96
114
  async getRecentJobs(queueName, limit = 100) {
package/dist/index.js CHANGED
@@ -13,6 +13,15 @@ export { getRecentJobsForQueue, getRecentJobsForSelection, QueueMonitoringServic
13
13
  export { createBullMQDriver } from './driver.js';
14
14
  export { createMetrics } from './metrics.js';
15
15
  export { createWorker as createQueueWorker } from './worker.js';
16
+ const emptyQueueCounts = () => ({
17
+ waiting: 0,
18
+ active: 0,
19
+ completed: 0,
20
+ failed: 0,
21
+ delayed: 0,
22
+ paused: 0,
23
+ });
24
+ const emptyQueueStats = (queues) => queues.map((name) => ({ name, counts: emptyQueueCounts() }));
16
25
  const DEFAULTS = {
17
26
  enabled: true,
18
27
  basePath: '/queue-monitor',
@@ -268,8 +277,8 @@ function createGetSnapshot(driver, startedAt, knownQueues) {
268
277
  }));
269
278
  }
270
279
  catch (error) {
271
- Logger.warn('[queue-monitor] Queue count lookup failed; returning empty snapshot', error);
272
- return [];
280
+ Logger.warn('[queue-monitor] Queue count lookup failed; returning known queues with empty counts', error);
281
+ return emptyQueueStats(queues);
273
282
  }
274
283
  })();
275
284
  if (QUEUE_MONITOR_LOGGING_ENABLED) {
@@ -13,6 +13,15 @@ import { createMetrics } from './metrics.js';
13
13
  import { emptyLockAnalytics } from './QueueMonitoringService.js';
14
14
  export { createMetrics } from './metrics.js';
15
15
  export { createWorker as createQueueWorker } from './worker.js';
16
+ const emptyQueueCounts = () => ({
17
+ waiting: 0,
18
+ active: 0,
19
+ completed: 0,
20
+ failed: 0,
21
+ delayed: 0,
22
+ paused: 0,
23
+ });
24
+ const emptyQueueStats = (queues) => queues.map((name) => ({ name, counts: emptyQueueCounts() }));
16
25
  const DEFAULTS = {
17
26
  enabled: true,
18
27
  basePath: '/queue-monitor',
@@ -189,8 +198,8 @@ function createGetSnapshot(driver, startedAt, knownQueues) {
189
198
  const counts = await driver.getJobCounts(name).catch(() => ({}));
190
199
  return { name, counts: counts };
191
200
  })).catch((error) => {
192
- Logger.warn('[queue-monitor] Queue count lookup failed; returning empty snapshot', error);
193
- return [];
201
+ Logger.warn('[queue-monitor] Queue count lookup failed; returning known queues with empty counts', error);
202
+ return emptyQueueStats(queues);
194
203
  });
195
204
  return {
196
205
  status: 'ok',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zintrust/queue-monitor",
3
- "version": "2.4.3",
3
+ "version": "2.4.4",
4
4
  "description": "Queue monitoring package for ZinTrust with BullMQ and Redis.",
5
5
  "private": false,
6
6
  "type": "module",