bunqueue 2.8.60 → 2.9.0
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/README.md +108 -76
- package/dist/application/background/dlq.js +2 -0
- package/dist/application/contextFactory.js +5 -0
- package/dist/application/dlqManager.d.ts +10 -0
- package/dist/application/dlqManager.js +47 -9
- package/dist/application/dlqRetry.js +59 -38
- package/dist/application/eventsManager.d.ts +1 -1
- package/dist/application/eventsManager.js +30 -26
- package/dist/application/operations/jobManagement.d.ts +4 -0
- package/dist/application/operations/jobMoveOperations.js +9 -4
- package/dist/application/postgres-queue-manager/batchSnapshot.d.ts +16 -0
- package/dist/application/postgres-queue-manager/batchSnapshot.js +17 -0
- package/dist/application/postgres-queue-manager/cloud.d.ts +30 -0
- package/dist/application/postgres-queue-manager/cloud.js +55 -0
- package/dist/application/postgres-queue-manager/config.d.ts +5 -0
- package/dist/application/postgres-queue-manager/config.js +1 -0
- package/dist/application/postgres-queue-manager/control.d.ts +26 -0
- package/dist/application/postgres-queue-manager/control.js +186 -0
- package/dist/application/postgres-queue-manager/deferredWrites.d.ts +13 -0
- package/dist/application/postgres-queue-manager/deferredWrites.js +60 -0
- package/dist/application/postgres-queue-manager/delivery.d.ts +19 -0
- package/dist/application/postgres-queue-manager/delivery.js +80 -0
- package/dist/application/postgres-queue-manager/lease.d.ts +13 -0
- package/dist/application/postgres-queue-manager/lease.js +88 -0
- package/dist/application/postgres-queue-manager/lifetimeMetrics.d.ts +32 -0
- package/dist/application/postgres-queue-manager/lifetimeMetrics.js +53 -0
- package/dist/application/postgres-queue-manager/maintenance.d.ts +14 -0
- package/dist/application/postgres-queue-manager/maintenance.js +100 -0
- package/dist/application/postgres-queue-manager/operationGate.d.ts +26 -0
- package/dist/application/postgres-queue-manager/operationGate.js +96 -0
- package/dist/application/postgres-queue-manager/operations.d.ts +25 -0
- package/dist/application/postgres-queue-manager/operations.js +194 -0
- package/dist/application/postgres-queue-manager/projectionRefreshes.d.ts +43 -0
- package/dist/application/postgres-queue-manager/projectionRefreshes.js +170 -0
- package/dist/application/postgres-queue-manager/queries.d.ts +142 -0
- package/dist/application/postgres-queue-manager/queries.js +231 -0
- package/dist/application/postgres-queue-manager/relationships.d.ts +10 -0
- package/dist/application/postgres-queue-manager/relationships.js +45 -0
- package/dist/application/postgres-queue-manager/services.d.ts +31 -0
- package/dist/application/postgres-queue-manager/services.js +149 -0
- package/dist/application/postgres-queue-manager/snapshot.d.ts +51 -0
- package/dist/application/postgres-queue-manager/snapshot.js +236 -0
- package/dist/application/postgres-queue-manager/snapshotViews.d.ts +15 -0
- package/dist/application/postgres-queue-manager/snapshotViews.js +100 -0
- package/dist/application/postgres-queue-manager/startupEventBuffer.d.ts +12 -0
- package/dist/application/postgres-queue-manager/startupEventBuffer.js +36 -0
- package/dist/application/postgres-queue-manager/state.d.ts +47 -0
- package/dist/application/postgres-queue-manager/state.js +273 -0
- package/dist/application/postgres-queue-manager/terminalDelivery.d.ts +20 -0
- package/dist/application/postgres-queue-manager/terminalDelivery.js +100 -0
- package/dist/application/postgresQueueManager.d.ts +2 -0
- package/dist/application/postgresQueueManager.js +1 -0
- package/dist/application/queue-manager/flow-failures.js +4 -0
- package/dist/application/queue-manager/limits.d.ts +2 -0
- package/dist/application/queue-manager/limits.js +4 -0
- package/dist/application/queue-manager/observability.js +15 -3
- package/dist/application/queue-manager/queries.d.ts +7 -0
- package/dist/application/queue-manager/queries.js +9 -0
- package/dist/application/queue-manager/services.d.ts +1 -1
- package/dist/application/queue-manager/services.js +4 -2
- package/dist/application/queue-manager/state.js +16 -1
- package/dist/cli/commands/server.js +1 -1
- package/dist/client/forwarder.d.ts +6 -4
- package/dist/client/forwarder.js +5 -3
- package/dist/client/queue/dlq.d.ts +2 -0
- package/dist/client/queue/dlq.js +14 -0
- package/dist/client/queue/dlqOps.d.ts +2 -0
- package/dist/client/queue/dlqOps.js +4 -0
- package/dist/client/queue/helpers.js +2 -0
- package/dist/client/queue/runtime/configuration.d.ts +4 -0
- package/dist/client/queue/runtime/configuration.js +8 -0
- package/dist/client/worker/runtime/execution.js +3 -8
- package/dist/client/worker/runtime/polling.d.ts +1 -0
- package/dist/client/worker/runtime/polling.js +9 -0
- package/dist/config/resolve.d.ts +14 -0
- package/dist/config/resolve.js +50 -5
- package/dist/config/types.d.ts +18 -0
- package/dist/domain/queue/dlqShard.d.ts +2 -0
- package/dist/domain/queue/dlqShard.js +16 -0
- package/dist/domain/queue/shard/dlq.d.ts +1 -0
- package/dist/domain/queue/shard/dlq.js +3 -0
- package/dist/domain/types/commands/dlq.d.ts +5 -0
- package/dist/domain/types/commands/union.d.ts +1 -1
- package/dist/domain/types/cron.d.ts +5 -0
- package/dist/domain/types/cron.js +14 -3
- package/dist/domain/types/dlq.d.ts +1 -1
- package/dist/domain/types/dlq.js +1 -2
- package/dist/domain/types/jobs/model.d.ts +1 -1
- package/dist/infrastructure/cloud/commandHandler.js +5 -3
- package/dist/infrastructure/cloud/commands/integrations.js +11 -11
- package/dist/infrastructure/cloud/commands/jobs.js +48 -40
- package/dist/infrastructure/cloud/commands/queues.js +61 -75
- package/dist/infrastructure/cloud/queueAdapter/local.d.ts +41 -0
- package/dist/infrastructure/cloud/queueAdapter/local.js +187 -0
- package/dist/infrastructure/cloud/queueAdapter/postgres.d.ts +42 -0
- package/dist/infrastructure/cloud/queueAdapter/postgres.js +188 -0
- package/dist/infrastructure/cloud/queueAdapter/registry.d.ts +4 -0
- package/dist/infrastructure/cloud/queueAdapter/registry.js +15 -0
- package/dist/infrastructure/cloud/queueAdapter/types.d.ts +87 -0
- package/dist/infrastructure/cloud/queueAdapter/types.js +1 -0
- package/dist/infrastructure/cloud/snapshot/analytics.d.ts +2 -0
- package/dist/infrastructure/cloud/snapshot/analytics.js +7 -0
- package/dist/infrastructure/cloud/snapshot/collector.d.ts +4 -0
- package/dist/infrastructure/cloud/snapshot/collector.js +39 -1
- package/dist/infrastructure/cloud/snapshot/config.d.ts +3 -0
- package/dist/infrastructure/cloud/snapshot/config.js +43 -0
- package/dist/infrastructure/cloud/snapshot/jobs.d.ts +3 -0
- package/dist/infrastructure/cloud/snapshot/jobs.js +32 -1
- package/dist/infrastructure/cloud/snapshotCollector.js +20 -35
- package/dist/infrastructure/cloud/snapshotHelpers.d.ts +3 -3
- package/dist/infrastructure/cloud/snapshotHelpers.js +3 -3
- package/dist/infrastructure/cloud/statsRefresh.js +2 -1
- package/dist/infrastructure/cloud/types/command.d.ts +2 -2
- package/dist/infrastructure/persistence/postgres/admission.d.ts +18 -0
- package/dist/infrastructure/persistence/postgres/admission.js +193 -0
- package/dist/infrastructure/persistence/postgres/admissionParent.d.ts +5 -0
- package/dist/infrastructure/persistence/postgres/admissionParent.js +35 -0
- package/dist/infrastructure/persistence/postgres/admissionResult.d.ts +9 -0
- package/dist/infrastructure/persistence/postgres/admissionResult.js +1 -0
- package/dist/infrastructure/persistence/postgres/admissionStore.d.ts +12 -0
- package/dist/infrastructure/persistence/postgres/admissionStore.js +101 -0
- package/dist/infrastructure/persistence/postgres/advisoryLocks.d.ts +2 -0
- package/dist/infrastructure/persistence/postgres/advisoryLocks.js +13 -0
- package/dist/infrastructure/persistence/postgres/batchAdmission.d.ts +11 -0
- package/dist/infrastructure/persistence/postgres/batchAdmission.js +110 -0
- package/dist/infrastructure/persistence/postgres/batchCompletion.d.ts +4 -0
- package/dist/infrastructure/persistence/postgres/batchCompletion.js +174 -0
- package/dist/infrastructure/persistence/postgres/batchEvents.d.ts +14 -0
- package/dist/infrastructure/persistence/postgres/batchEvents.js +72 -0
- package/dist/infrastructure/persistence/postgres/brokerSessions.d.ts +14 -0
- package/dist/infrastructure/persistence/postgres/brokerSessions.js +94 -0
- package/dist/infrastructure/persistence/postgres/claimBatch.d.ts +11 -0
- package/dist/infrastructure/persistence/postgres/claimBatch.js +56 -0
- package/dist/infrastructure/persistence/postgres/claimSelection.d.ts +4 -0
- package/dist/infrastructure/persistence/postgres/claimSelection.js +198 -0
- package/dist/infrastructure/persistence/postgres/claims.d.ts +3 -0
- package/dist/infrastructure/persistence/postgres/claims.js +137 -0
- package/dist/infrastructure/persistence/postgres/cloudReadModel.d.ts +26 -0
- package/dist/infrastructure/persistence/postgres/cloudReadModel.js +123 -0
- package/dist/infrastructure/persistence/postgres/codec.d.ts +30 -0
- package/dist/infrastructure/persistence/postgres/codec.js +82 -0
- package/dist/infrastructure/persistence/postgres/completionEvents.d.ts +11 -0
- package/dist/infrastructure/persistence/postgres/completionEvents.js +21 -0
- package/dist/infrastructure/persistence/postgres/completionLifecycle.d.ts +11 -0
- package/dist/infrastructure/persistence/postgres/completionLifecycle.js +145 -0
- package/dist/infrastructure/persistence/postgres/completionOutcome.d.ts +4 -0
- package/dist/infrastructure/persistence/postgres/completionOutcome.js +112 -0
- package/dist/infrastructure/persistence/postgres/completionQueries.d.ts +10 -0
- package/dist/infrastructure/persistence/postgres/completionQueries.js +87 -0
- package/dist/infrastructure/persistence/postgres/connection.d.ts +3 -0
- package/dist/infrastructure/persistence/postgres/connection.js +15 -0
- package/dist/infrastructure/persistence/postgres/context.d.ts +28 -0
- package/dist/infrastructure/persistence/postgres/context.js +74 -0
- package/dist/infrastructure/persistence/postgres/control.d.ts +23 -0
- package/dist/infrastructure/persistence/postgres/control.js +105 -0
- package/dist/infrastructure/persistence/postgres/crons.d.ts +18 -0
- package/dist/infrastructure/persistence/postgres/crons.js +205 -0
- package/dist/infrastructure/persistence/postgres/deduplication.d.ts +9 -0
- package/dist/infrastructure/persistence/postgres/deduplication.js +47 -0
- package/dist/infrastructure/persistence/postgres/dependencyDestruction.d.ts +14 -0
- package/dist/infrastructure/persistence/postgres/dependencyDestruction.js +74 -0
- package/dist/infrastructure/persistence/postgres/dependencyPromotion.d.ts +29 -0
- package/dist/infrastructure/persistence/postgres/dependencyPromotion.js +212 -0
- package/dist/infrastructure/persistence/postgres/destructiveMutations.d.ts +4 -0
- package/dist/infrastructure/persistence/postgres/destructiveMutations.js +111 -0
- package/dist/infrastructure/persistence/postgres/dlqLifecycle.d.ts +13 -0
- package/dist/infrastructure/persistence/postgres/dlqLifecycle.js +184 -0
- package/dist/infrastructure/persistence/postgres/dlqMaintenance.d.ts +6 -0
- package/dist/infrastructure/persistence/postgres/dlqMaintenance.js +36 -0
- package/dist/infrastructure/persistence/postgres/dlqRetryPlan.d.ts +21 -0
- package/dist/infrastructure/persistence/postgres/dlqRetryPlan.js +92 -0
- package/dist/infrastructure/persistence/postgres/eventCommitGc.d.ts +27 -0
- package/dist/infrastructure/persistence/postgres/eventCommitGc.js +62 -0
- package/dist/infrastructure/persistence/postgres/eventJournal.d.ts +18 -0
- package/dist/infrastructure/persistence/postgres/eventJournal.js +76 -0
- package/dist/infrastructure/persistence/postgres/eventJournalSchema.d.ts +5 -0
- package/dist/infrastructure/persistence/postgres/eventJournalSchema.js +253 -0
- package/dist/infrastructure/persistence/postgres/eventPruneWatermarks.d.ts +24 -0
- package/dist/infrastructure/persistence/postgres/eventPruneWatermarks.js +111 -0
- package/dist/infrastructure/persistence/postgres/eventRetention.d.ts +18 -0
- package/dist/infrastructure/persistence/postgres/eventRetention.js +76 -0
- package/dist/infrastructure/persistence/postgres/events.d.ts +45 -0
- package/dist/infrastructure/persistence/postgres/events.js +249 -0
- package/dist/infrastructure/persistence/postgres/expiry.d.ts +3 -0
- package/dist/infrastructure/persistence/postgres/expiry.js +74 -0
- package/dist/infrastructure/persistence/postgres/flowFailures.d.ts +17 -0
- package/dist/infrastructure/persistence/postgres/flowFailures.js +199 -0
- package/dist/infrastructure/persistence/postgres/jobData.d.ts +3 -0
- package/dist/infrastructure/persistence/postgres/jobData.js +32 -0
- package/dist/infrastructure/persistence/postgres/leaseRelease.d.ts +9 -0
- package/dist/infrastructure/persistence/postgres/leaseRelease.js +120 -0
- package/dist/infrastructure/persistence/postgres/leaseRenewal.d.ts +4 -0
- package/dist/infrastructure/persistence/postgres/leaseRenewal.js +35 -0
- package/dist/infrastructure/persistence/postgres/lifetimeMetrics.d.ts +15 -0
- package/dist/infrastructure/persistence/postgres/lifetimeMetrics.js +46 -0
- package/dist/infrastructure/persistence/postgres/lifetimeMetricsFinalizer.d.ts +4 -0
- package/dist/infrastructure/persistence/postgres/lifetimeMetricsFinalizer.js +13 -0
- package/dist/infrastructure/persistence/postgres/logs.d.ts +6 -0
- package/dist/infrastructure/persistence/postgres/logs.js +70 -0
- package/dist/infrastructure/persistence/postgres/maintenance.d.ts +6 -0
- package/dist/infrastructure/persistence/postgres/maintenance.js +138 -0
- package/dist/infrastructure/persistence/postgres/maintenanceFlights.d.ts +14 -0
- package/dist/infrastructure/persistence/postgres/maintenanceFlights.js +66 -0
- package/dist/infrastructure/persistence/postgres/metricWrites.d.ts +9 -0
- package/dist/infrastructure/persistence/postgres/metricWrites.js +94 -0
- package/dist/infrastructure/persistence/postgres/mutations.d.ts +9 -0
- package/dist/infrastructure/persistence/postgres/mutations.js +171 -0
- package/dist/infrastructure/persistence/postgres/outcomes.d.ts +4 -0
- package/dist/infrastructure/persistence/postgres/outcomes.js +194 -0
- package/dist/infrastructure/persistence/postgres/policies.d.ts +11 -0
- package/dist/infrastructure/persistence/postgres/policies.js +18 -0
- package/dist/infrastructure/persistence/postgres/postCommitMaintenance.d.ts +17 -0
- package/dist/infrastructure/persistence/postgres/postCommitMaintenance.js +117 -0
- package/dist/infrastructure/persistence/postgres/promotion.d.ts +3 -0
- package/dist/infrastructure/persistence/postgres/promotion.js +43 -0
- package/dist/infrastructure/persistence/postgres/queries.d.ts +22 -0
- package/dist/infrastructure/persistence/postgres/queries.js +152 -0
- package/dist/infrastructure/persistence/postgres/queueDestruction.d.ts +3 -0
- package/dist/infrastructure/persistence/postgres/queueDestruction.js +154 -0
- package/dist/infrastructure/persistence/postgres/queueLifecycle.d.ts +10 -0
- package/dist/infrastructure/persistence/postgres/queueLifecycle.js +60 -0
- package/dist/infrastructure/persistence/postgres/rateLimit.d.ts +6 -0
- package/dist/infrastructure/persistence/postgres/rateLimit.js +10 -0
- package/dist/infrastructure/persistence/postgres/readModels.d.ts +32 -0
- package/dist/infrastructure/persistence/postgres/readModels.js +72 -0
- package/dist/infrastructure/persistence/postgres/recovery.d.ts +3 -0
- package/dist/infrastructure/persistence/postgres/recovery.js +178 -0
- package/dist/infrastructure/persistence/postgres/relationships.d.ts +9 -0
- package/dist/infrastructure/persistence/postgres/relationships.js +201 -0
- package/dist/infrastructure/persistence/postgres/removeUnprocessedChildren.d.ts +4 -0
- package/dist/infrastructure/persistence/postgres/removeUnprocessedChildren.js +241 -0
- package/dist/infrastructure/persistence/postgres/repeatMutations.d.ts +5 -0
- package/dist/infrastructure/persistence/postgres/repeatMutations.js +37 -0
- package/dist/infrastructure/persistence/postgres/runtime.d.ts +46 -0
- package/dist/infrastructure/persistence/postgres/runtime.js +236 -0
- package/dist/infrastructure/persistence/postgres/runtimeConfig.d.ts +21 -0
- package/dist/infrastructure/persistence/postgres/runtimeConfig.js +39 -0
- package/dist/infrastructure/persistence/postgres/schema.d.ts +4 -0
- package/dist/infrastructure/persistence/postgres/schema.js +257 -0
- package/dist/infrastructure/persistence/postgres/schemaInitialization.d.ts +3 -0
- package/dist/infrastructure/persistence/postgres/schemaInitialization.js +221 -0
- package/dist/infrastructure/persistence/postgres/serialAdmission.d.ts +6 -0
- package/dist/infrastructure/persistence/postgres/serialAdmission.js +96 -0
- package/dist/infrastructure/persistence/postgres/snapshotBudget.d.ts +3 -0
- package/dist/infrastructure/persistence/postgres/snapshotBudget.js +83 -0
- package/dist/infrastructure/persistence/postgres/storageHealth.d.ts +10 -0
- package/dist/infrastructure/persistence/postgres/storageHealth.js +29 -0
- package/dist/infrastructure/persistence/postgres/store.d.ts +90 -0
- package/dist/infrastructure/persistence/postgres/store.js +136 -0
- package/dist/infrastructure/persistence/postgres/telemetry.d.ts +6 -0
- package/dist/infrastructure/persistence/postgres/telemetry.js +88 -0
- package/dist/infrastructure/persistence/postgres/terminal.d.ts +8 -0
- package/dist/infrastructure/persistence/postgres/terminal.js +137 -0
- package/dist/infrastructure/persistence/postgres/transactionRetry.d.ts +6 -0
- package/dist/infrastructure/persistence/postgres/transactionRetry.js +42 -0
- package/dist/infrastructure/persistence/postgres/types.d.ts +175 -0
- package/dist/infrastructure/persistence/postgres/types.js +1 -0
- package/dist/infrastructure/persistence/postgres/workers.d.ts +15 -0
- package/dist/infrastructure/persistence/postgres/workers.js +126 -0
- package/dist/infrastructure/persistence/postgres.d.ts +2 -0
- package/dist/infrastructure/persistence/postgres.js +1 -0
- package/dist/infrastructure/persistence/sqlite/jobs.js +2 -0
- package/dist/infrastructure/scheduler/cron/persisted.d.ts +5 -0
- package/dist/infrastructure/scheduler/cron/persisted.js +27 -0
- package/dist/infrastructure/scheduler/cron/runtime.js +5 -10
- package/dist/infrastructure/scheduler/cron/validation.d.ts +3 -0
- package/dist/infrastructure/scheduler/cron/validation.js +11 -0
- package/dist/infrastructure/scheduler/cronParser.d.ts +1 -1
- package/dist/infrastructure/scheduler/cronParser.js +144 -11
- package/dist/infrastructure/server/bootstrap.d.ts +2 -3
- package/dist/infrastructure/server/bootstrap.js +33 -59
- package/dist/infrastructure/server/errors.d.ts +4 -0
- package/dist/infrastructure/server/errors.js +54 -0
- package/dist/infrastructure/server/handler-routes/control.d.ts +5 -5
- package/dist/infrastructure/server/handler-routes/control.js +3 -1
- package/dist/infrastructure/server/handler-routes/monitoring.d.ts +2 -2
- package/dist/infrastructure/server/handler.js +9 -11
- package/dist/infrastructure/server/handlers/advanced/dependencies.js +7 -6
- package/dist/infrastructure/server/handlers/advanced/jobs.js +19 -6
- package/dist/infrastructure/server/handlers/advanced/queue.d.ts +9 -9
- package/dist/infrastructure/server/handlers/advanced/queue.js +91 -27
- package/dist/infrastructure/server/handlers/core.js +32 -31
- package/dist/infrastructure/server/handlers/cron.d.ts +4 -4
- package/dist/infrastructure/server/handlers/cron.js +60 -59
- package/dist/infrastructure/server/handlers/dashboard.d.ts +1 -1
- package/dist/infrastructure/server/handlers/dashboard.js +21 -8
- package/dist/infrastructure/server/handlers/dlq.d.ts +6 -3
- package/dist/infrastructure/server/handlers/dlq.js +35 -9
- package/dist/infrastructure/server/handlers/flow.js +2 -1
- package/dist/infrastructure/server/handlers/management.d.ts +5 -5
- package/dist/infrastructure/server/handlers/management.js +36 -9
- package/dist/infrastructure/server/handlers/monitoring/health.d.ts +5 -5
- package/dist/infrastructure/server/handlers/monitoring/health.js +45 -16
- package/dist/infrastructure/server/handlers/monitoring/operations.d.ts +1 -1
- package/dist/infrastructure/server/handlers/monitoring/operations.js +8 -1
- package/dist/infrastructure/server/handlers/monitoring/workers.d.ts +3 -3
- package/dist/infrastructure/server/handlers/monitoring/workers.js +31 -7
- package/dist/infrastructure/server/handlers/pushBatchValidation.d.ts +3 -1
- package/dist/infrastructure/server/handlers/pushBatchValidation.js +52 -7
- package/dist/infrastructure/server/handlers/query.d.ts +1 -1
- package/dist/infrastructure/server/handlers/query.js +5 -4
- package/dist/infrastructure/server/http.js +2 -2
- package/dist/infrastructure/server/httpDashboardEndpoints.d.ts +1 -1
- package/dist/infrastructure/server/httpDashboardEndpoints.js +19 -6
- package/dist/infrastructure/server/httpEndpoints.js +18 -7
- package/dist/infrastructure/server/httpRouteQueues.js +11 -1
- package/dist/infrastructure/server/shutdownCoordinator.d.ts +24 -0
- package/dist/infrastructure/server/shutdownCoordinator.js +106 -0
- package/dist/infrastructure/server/sseHandler.js +8 -3
- package/dist/infrastructure/server/storageAdapter.d.ts +29 -0
- package/dist/infrastructure/server/storageAdapter.js +61 -0
- package/dist/infrastructure/server/storageManager.d.ts +12 -0
- package/dist/infrastructure/server/storageManager.js +102 -0
- package/dist/infrastructure/server/tcp.js +2 -3
- package/dist/infrastructure/server/ws/snapshots.d.ts +1 -1
- package/dist/infrastructure/server/ws/snapshots.js +19 -4
- package/dist/infrastructure/server/wsHandler.js +10 -5
- package/dist/main.js +1 -1
- package/dist/mcp/backend/embedded/services.js +2 -1
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js +2 -2
- package/dist/shared/storageHealth.d.ts +9 -0
- package/dist/shared/storageHealth.js +12 -0
- package/package.json +74 -65
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { QueueManager } from '../../../application/queueManager';
|
|
2
|
+
import type { CronJob, CronJobInput } from '../../../domain/types/cron';
|
|
3
|
+
import type { DlqConfig, DlqEntry } from '../../../domain/types/dlq';
|
|
4
|
+
import type { Job, JobId } from '../../../domain/types/job';
|
|
5
|
+
import type { StallConfig } from '../../../domain/types/stall';
|
|
6
|
+
import type { JobLogEntry, Worker } from '../../../domain/types/worker';
|
|
7
|
+
export interface CloudQueueCounts {
|
|
8
|
+
waiting: number;
|
|
9
|
+
prioritized: number;
|
|
10
|
+
delayed: number;
|
|
11
|
+
active: number;
|
|
12
|
+
completed: number;
|
|
13
|
+
failed: number;
|
|
14
|
+
'waiting-children': number;
|
|
15
|
+
totalCompleted: number;
|
|
16
|
+
totalFailed: number;
|
|
17
|
+
}
|
|
18
|
+
export interface CloudQueueSource {
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly counts: CloudQueueCounts;
|
|
21
|
+
readonly paused: boolean;
|
|
22
|
+
readonly rateLimit: number | null;
|
|
23
|
+
readonly concurrencyLimit: number | null;
|
|
24
|
+
readonly stallConfig: StallConfig;
|
|
25
|
+
readonly dlqConfig: DlqConfig;
|
|
26
|
+
}
|
|
27
|
+
export interface CloudSourceJob {
|
|
28
|
+
readonly job: Job;
|
|
29
|
+
readonly state: string;
|
|
30
|
+
}
|
|
31
|
+
export interface CloudSourceLock {
|
|
32
|
+
readonly jobId: string;
|
|
33
|
+
readonly owner: string;
|
|
34
|
+
readonly token: string;
|
|
35
|
+
readonly createdAt: number;
|
|
36
|
+
readonly expiresAt: number;
|
|
37
|
+
readonly lastRenewalAt: number;
|
|
38
|
+
readonly renewalCount: number;
|
|
39
|
+
readonly ttl: number;
|
|
40
|
+
}
|
|
41
|
+
export interface CloudSnapshotSource {
|
|
42
|
+
readonly stats: ReturnType<QueueManager['getStats']>;
|
|
43
|
+
readonly queues: readonly CloudQueueSource[];
|
|
44
|
+
readonly jobs: readonly CloudSourceJob[];
|
|
45
|
+
readonly dlqEntries: readonly DlqEntry[];
|
|
46
|
+
readonly workers: readonly Worker[];
|
|
47
|
+
readonly workerStats: ReturnType<QueueManager['workerManager']['getStats']>;
|
|
48
|
+
readonly crons: readonly CronJob[];
|
|
49
|
+
readonly jobResults: ReadonlyMap<string, unknown>;
|
|
50
|
+
readonly jobLogs: ReadonlyMap<string, readonly JobLogEntry[]>;
|
|
51
|
+
readonly activeLocks: readonly CloudSourceLock[];
|
|
52
|
+
}
|
|
53
|
+
export interface CloudQueueAdapter {
|
|
54
|
+
readonly manager: QueueManager;
|
|
55
|
+
pause(queue: string, paused: boolean): Promise<void>;
|
|
56
|
+
drain(queue: string): Promise<number>;
|
|
57
|
+
clean(queue: string, graceMs: number, state?: string, limit?: number): Promise<JobId[]>;
|
|
58
|
+
obliterate(queue: string): Promise<void>;
|
|
59
|
+
promoteAll(queue: string, limit: number): Promise<number>;
|
|
60
|
+
retryCompleted(queue: string): Promise<number>;
|
|
61
|
+
setRateLimit(queue: string, limit: number | null): Promise<void>;
|
|
62
|
+
setConcurrency(queue: string, limit: number | null): Promise<void>;
|
|
63
|
+
setStallConfig(queue: string, patch: Record<string, unknown>): Promise<void>;
|
|
64
|
+
setDlqConfig(queue: string, patch: Record<string, unknown>): Promise<void>;
|
|
65
|
+
listJobs(queue: string, options?: {
|
|
66
|
+
state?: string | string[];
|
|
67
|
+
start?: number;
|
|
68
|
+
end?: number;
|
|
69
|
+
asc?: boolean;
|
|
70
|
+
}): Promise<Job[]>;
|
|
71
|
+
getJob(id: JobId): Promise<Job | null>;
|
|
72
|
+
getLogs(id: JobId): Promise<JobLogEntry[]>;
|
|
73
|
+
getResult(id: JobId): Promise<unknown>;
|
|
74
|
+
clearLogs(id: JobId, keepLogs?: number): Promise<void>;
|
|
75
|
+
retryDlq(queue: string, id?: JobId): Promise<number>;
|
|
76
|
+
purgeDlq(queue: string): Promise<number>;
|
|
77
|
+
push(queue: string, input: Parameters<QueueManager['push']>[1]): Promise<Job>;
|
|
78
|
+
cancel(id: JobId): Promise<boolean>;
|
|
79
|
+
promote(id: JobId): Promise<boolean>;
|
|
80
|
+
changePriority(id: JobId, priority: number): Promise<boolean>;
|
|
81
|
+
discard(id: JobId): Promise<boolean>;
|
|
82
|
+
changeDelay(id: JobId, delay: number): Promise<boolean>;
|
|
83
|
+
updateData(id: JobId, data: unknown): Promise<boolean>;
|
|
84
|
+
addCron(input: CronJobInput): Promise<CronJob>;
|
|
85
|
+
removeCron(name: string): Promise<boolean>;
|
|
86
|
+
readSnapshotSource(requestedQueues?: readonly string[]): Promise<CloudSnapshotSource>;
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { QueueManager } from '../../../application/queueManager';
|
|
2
2
|
import type { CloudSnapshot } from '../types';
|
|
3
|
+
import type { CloudSnapshotSource } from '../queueAdapter/types';
|
|
3
4
|
export declare function collectQueueThroughput(queues: Array<{
|
|
4
5
|
name: string;
|
|
5
6
|
totalCompleted: number;
|
|
6
7
|
totalFailed: number;
|
|
7
8
|
}>): CloudSnapshot['queueThroughput'];
|
|
8
9
|
export declare function collectWorkerUtilization(queueManager: QueueManager): CloudSnapshot['workerUtilization'];
|
|
10
|
+
export declare function mapSnapshotWorkerUtilization(workers: CloudSnapshotSource['workers']): CloudSnapshot['workerUtilization'];
|
|
9
11
|
export declare function collectDurationHistogram(recentJobs: CloudSnapshot['recentJobs']): CloudSnapshot['durationHistogram'];
|
|
10
12
|
export declare function collectQueueWaitTime(recentJobs: CloudSnapshot['recentJobs']): CloudSnapshot['queueWaitTime'];
|
|
11
13
|
export declare function collectQueueRetryRate(recentJobs: CloudSnapshot['recentJobs']): CloudSnapshot['queueRetryRate'];
|
|
@@ -35,6 +35,13 @@ export function collectWorkerUtilization(queueManager) {
|
|
|
35
35
|
utilization: worker.concurrency > 0 ? Math.round((worker.activeJobs / worker.concurrency) * 100) / 100 : 0,
|
|
36
36
|
}));
|
|
37
37
|
}
|
|
38
|
+
export function mapSnapshotWorkerUtilization(workers) {
|
|
39
|
+
return workers.map((worker) => ({
|
|
40
|
+
id: worker.id,
|
|
41
|
+
name: worker.name,
|
|
42
|
+
utilization: worker.concurrency > 0 ? Math.round((worker.activeJobs / worker.concurrency) * 100) / 100 : 0,
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
38
45
|
export function collectDurationHistogram(recentJobs) {
|
|
39
46
|
const histogram = { lt100ms: 0, lt1s: 0, lt10s: 0, lt60s: 0, gt60s: 0 };
|
|
40
47
|
for (const job of recentJobs) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { QueueManager } from '../../../application/queueManager';
|
|
2
2
|
import type { CloudSnapshot } from '../types';
|
|
3
3
|
import type { CollectSnapshotParams } from '../types/collector';
|
|
4
|
+
import type { CloudSnapshotSource } from '../queueAdapter/types';
|
|
4
5
|
/** Cached host and runtime metadata. */
|
|
5
6
|
export declare const SNAPSHOT_HOST: string;
|
|
6
7
|
export declare const SNAPSHOT_RUNTIME: {
|
|
@@ -16,9 +17,12 @@ export declare function resolveRedaction(params: CollectSnapshotParams): {
|
|
|
16
17
|
};
|
|
17
18
|
/** Map cron definitions to their snapshot shape. */
|
|
18
19
|
export declare function collectCrons(queueManager: QueueManager): CloudSnapshot['crons'];
|
|
20
|
+
export declare function mapSnapshotCrons(crons: CloudSnapshotSource['crons']): CloudSnapshot['crons'];
|
|
19
21
|
/** Back-fill failed-job timing from the last DLQ attempt. */
|
|
20
22
|
export declare function enrichFailedJobDurations(recentJobs: CloudSnapshot['recentJobs'], dlqEntries: CloudSnapshot['dlqEntries']): void;
|
|
21
23
|
/** Collect worker registry details and derived health fields. */
|
|
22
24
|
export declare function collectWorkerDetails(queueManager: QueueManager, now: number): CloudSnapshot['workerDetails'];
|
|
25
|
+
export declare function mapSnapshotWorkers(workers: CloudSnapshotSource['workers'], now: number): CloudSnapshot['workerDetails'];
|
|
23
26
|
/** Collect results, logs, and active locks for the snapshot. */
|
|
24
27
|
export declare function collectJobArtifacts(queueManager: QueueManager): Pick<CloudSnapshot, 'jobResults' | 'jobLogEntries' | 'activeLocks'>;
|
|
28
|
+
export declare function mapSnapshotJobArtifacts(source: CloudSnapshotSource): Pick<CloudSnapshot, 'jobResults' | 'jobLogEntries' | 'activeLocks'>;
|
|
@@ -16,7 +16,10 @@ export function resolveRedaction(params) {
|
|
|
16
16
|
}
|
|
17
17
|
/** Map cron definitions to their snapshot shape. */
|
|
18
18
|
export function collectCrons(queueManager) {
|
|
19
|
-
return queueManager.listCrons()
|
|
19
|
+
return mapSnapshotCrons(queueManager.listCrons());
|
|
20
|
+
}
|
|
21
|
+
export function mapSnapshotCrons(crons) {
|
|
22
|
+
return crons.map((cron) => ({
|
|
20
23
|
name: cron.name,
|
|
21
24
|
queue: cron.queue,
|
|
22
25
|
schedule: cron.schedule ?? null,
|
|
@@ -83,6 +86,34 @@ export function collectWorkerDetails(queueManager, now) {
|
|
|
83
86
|
};
|
|
84
87
|
});
|
|
85
88
|
}
|
|
89
|
+
export function mapSnapshotWorkers(workers, now) {
|
|
90
|
+
const workerTimeoutMs = 30_000;
|
|
91
|
+
return workers.map((worker) => {
|
|
92
|
+
const totalJobs = worker.processedJobs + worker.failedJobs;
|
|
93
|
+
return {
|
|
94
|
+
id: worker.id,
|
|
95
|
+
name: worker.name,
|
|
96
|
+
queues: worker.queues,
|
|
97
|
+
concurrency: worker.concurrency,
|
|
98
|
+
hostname: worker.hostname,
|
|
99
|
+
pid: worker.pid,
|
|
100
|
+
registeredAt: worker.registeredAt,
|
|
101
|
+
lastSeen: worker.lastSeen,
|
|
102
|
+
activeJobs: worker.activeJobs,
|
|
103
|
+
processedJobs: worker.processedJobs,
|
|
104
|
+
failedJobs: worker.failedJobs,
|
|
105
|
+
currentJob: worker.currentJob,
|
|
106
|
+
uptime: now - worker.registeredAt,
|
|
107
|
+
status: now - worker.lastSeen > workerTimeoutMs
|
|
108
|
+
? 'stalled'
|
|
109
|
+
: worker.activeJobs > 0
|
|
110
|
+
? 'active'
|
|
111
|
+
: 'idle',
|
|
112
|
+
errorRate: totalJobs > 0 ? +(worker.failedJobs / totalJobs).toFixed(4) : 0,
|
|
113
|
+
utilization: worker.concurrency > 0 ? +(worker.activeJobs / worker.concurrency).toFixed(4) : 0,
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
}
|
|
86
117
|
/** Collect results, logs, and active locks for the snapshot. */
|
|
87
118
|
export function collectJobArtifacts(queueManager) {
|
|
88
119
|
const jobResults = {};
|
|
@@ -103,3 +134,10 @@ export function collectJobArtifacts(queueManager) {
|
|
|
103
134
|
}));
|
|
104
135
|
return { jobResults, jobLogEntries, activeLocks };
|
|
105
136
|
}
|
|
137
|
+
export function mapSnapshotJobArtifacts(source) {
|
|
138
|
+
return {
|
|
139
|
+
jobResults: Object.fromEntries(source.jobResults),
|
|
140
|
+
jobLogEntries: Object.fromEntries([...source.jobLogs].map(([id, logs]) => [id, [...logs]])),
|
|
141
|
+
activeLocks: [...source.activeLocks],
|
|
142
|
+
};
|
|
143
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { QueueManager } from '../../../application/queueManager';
|
|
2
2
|
import type { CloudSnapshot } from '../types';
|
|
3
|
+
import type { CloudSnapshotSource } from '../queueAdapter/types';
|
|
3
4
|
export declare function collectQueueConfigs(queueManager: QueueManager, queueNames: Set<string>): CloudSnapshot['queueConfigs'];
|
|
5
|
+
export declare function mapSnapshotQueueConfigs(queues: CloudSnapshotSource['queues']): CloudSnapshot['queueConfigs'];
|
|
4
6
|
export declare function collectWebhooks(queueManager: QueueManager): CloudSnapshot['webhooks'];
|
|
5
7
|
export declare function collectTopErrors(queueManager: QueueManager, dlqQueueNames: string[]): CloudSnapshot['topErrors'];
|
|
8
|
+
export declare function mapSnapshotTopErrors(entries: CloudSnapshotSource['dlqEntries']): CloudSnapshot['topErrors'];
|
|
@@ -33,6 +33,30 @@ export function collectQueueConfigs(queueManager, queueNames) {
|
|
|
33
33
|
}
|
|
34
34
|
return configs;
|
|
35
35
|
}
|
|
36
|
+
export function mapSnapshotQueueConfigs(queues) {
|
|
37
|
+
return Object.fromEntries(queues.map((queue) => [
|
|
38
|
+
queue.name,
|
|
39
|
+
{
|
|
40
|
+
paused: queue.paused,
|
|
41
|
+
rateLimit: queue.rateLimit,
|
|
42
|
+
concurrencyLimit: queue.concurrencyLimit,
|
|
43
|
+
concurrencyActive: queue.counts.active,
|
|
44
|
+
stallConfig: {
|
|
45
|
+
enabled: queue.stallConfig.enabled,
|
|
46
|
+
stallInterval: queue.stallConfig.stallInterval,
|
|
47
|
+
maxStalls: queue.stallConfig.maxStalls,
|
|
48
|
+
gracePeriod: queue.stallConfig.gracePeriod,
|
|
49
|
+
},
|
|
50
|
+
dlqConfig: {
|
|
51
|
+
autoRetry: queue.dlqConfig.autoRetry,
|
|
52
|
+
autoRetryInterval: queue.dlqConfig.autoRetryInterval,
|
|
53
|
+
maxRetries: queue.dlqConfig.maxAutoRetries,
|
|
54
|
+
maxAge: queue.dlqConfig.maxAge ?? 0,
|
|
55
|
+
maxEntries: queue.dlqConfig.maxEntries,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
]));
|
|
59
|
+
}
|
|
36
60
|
export function collectWebhooks(queueManager) {
|
|
37
61
|
try {
|
|
38
62
|
return queueManager.webhookManager.list().map((webhook) => ({
|
|
@@ -84,3 +108,22 @@ export function collectTopErrors(queueManager, dlqQueueNames) {
|
|
|
84
108
|
.map(([message, data]) => ({ message, ...data }))
|
|
85
109
|
.sort((a, b) => b.count - a.count);
|
|
86
110
|
}
|
|
111
|
+
export function mapSnapshotTopErrors(entries) {
|
|
112
|
+
const errors = new Map();
|
|
113
|
+
for (const entry of entries) {
|
|
114
|
+
const message = entry.error ?? entry.reason;
|
|
115
|
+
const current = errors.get(message);
|
|
116
|
+
if (!current) {
|
|
117
|
+
errors.set(message, { count: 1, queue: entry.job.queue, lastSeen: entry.enteredAt });
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
current.count++;
|
|
121
|
+
if (entry.enteredAt > current.lastSeen) {
|
|
122
|
+
current.lastSeen = entry.enteredAt;
|
|
123
|
+
current.queue = entry.job.queue;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return [...errors]
|
|
127
|
+
.map(([message, data]) => ({ message, ...data }))
|
|
128
|
+
.sort((a, b) => b.count - a.count);
|
|
129
|
+
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { QueueManager } from '../../../application/queueManager';
|
|
2
2
|
import type { CloudSnapshot } from '../types';
|
|
3
3
|
import type { RedactOptions } from '../types/redact';
|
|
4
|
+
import type { CloudSnapshotSource } from '../queueAdapter/types';
|
|
5
|
+
export declare function mapSnapshotJobs(jobs: CloudSnapshotSource['jobs'], redact: RedactOptions): CloudSnapshot['recentJobs'];
|
|
6
|
+
export declare function mapSnapshotDlqEntries(source: CloudSnapshotSource['dlqEntries'], redact: RedactOptions): CloudSnapshot['dlqEntries'];
|
|
4
7
|
export declare function collectLiveJobs(queueManager: QueueManager, queueNames: string[], redact: RedactOptions): CloudSnapshot['recentJobs'];
|
|
5
8
|
export declare function collectDlqEntries(queueManager: QueueManager, dlqQueueNames: string[], redact: RedactOptions): CloudSnapshot['dlqEntries'];
|
|
@@ -87,6 +87,37 @@ function mapJobExtended(job) {
|
|
|
87
87
|
function mapJobToSnapshot(job, state, redact) {
|
|
88
88
|
return { ...mapJobCore(job, state, redact), ...mapJobExtended(job) };
|
|
89
89
|
}
|
|
90
|
+
export function mapSnapshotJobs(jobs, redact) {
|
|
91
|
+
return jobs.map(({ job, state }) => mapJobToSnapshot(job, state, redact));
|
|
92
|
+
}
|
|
93
|
+
export function mapSnapshotDlqEntries(source, redact) {
|
|
94
|
+
return source
|
|
95
|
+
.map((entry) => ({
|
|
96
|
+
jobId: String(entry.job.id),
|
|
97
|
+
queue: entry.job.queue,
|
|
98
|
+
reason: entry.reason,
|
|
99
|
+
error: entry.error,
|
|
100
|
+
enteredAt: entry.enteredAt,
|
|
101
|
+
retryCount: entry.retryCount,
|
|
102
|
+
lastRetryAt: entry.lastRetryAt ?? undefined,
|
|
103
|
+
nextRetryAt: entry.nextRetryAt ?? undefined,
|
|
104
|
+
expiresAt: entry.expiresAt ?? undefined,
|
|
105
|
+
jobAttempts: entry.job.attempts,
|
|
106
|
+
jobMaxAttempts: entry.job.maxAttempts,
|
|
107
|
+
jobData: redact.includeJobData ? redactData(entry.job.data, redact.redactFields) : undefined,
|
|
108
|
+
jobCreatedAt: entry.job.createdAt,
|
|
109
|
+
jobPriority: entry.job.priority,
|
|
110
|
+
attemptHistory: entry.attempts.map((attempt) => ({
|
|
111
|
+
attempt: attempt.attempt,
|
|
112
|
+
startedAt: attempt.startedAt,
|
|
113
|
+
failedAt: attempt.failedAt,
|
|
114
|
+
reason: attempt.reason,
|
|
115
|
+
error: attempt.error,
|
|
116
|
+
duration: attempt.duration,
|
|
117
|
+
})),
|
|
118
|
+
}))
|
|
119
|
+
.sort((left, right) => right.enteredAt - left.enteredAt);
|
|
120
|
+
}
|
|
90
121
|
export function collectLiveJobs(queueManager, queueNames, redact) {
|
|
91
122
|
if (queueNames.length === 0)
|
|
92
123
|
return [];
|
|
@@ -94,7 +125,7 @@ export function collectLiveJobs(queueManager, queueNames, redact) {
|
|
|
94
125
|
for (const name of queueNames) {
|
|
95
126
|
for (const state of ALL_STATES) {
|
|
96
127
|
try {
|
|
97
|
-
const queueJobs = queueManager.getJobs(name, { state: [state], start: 0, end:
|
|
128
|
+
const queueJobs = queueManager.getJobs(name, { state: [state], start: 0, end: 1000 });
|
|
98
129
|
for (const job of queueJobs)
|
|
99
130
|
jobs.push(mapJobToSnapshot(job, state, redact));
|
|
100
131
|
}
|
|
@@ -9,63 +9,48 @@ import { throughputTracker } from '../../application/throughputTracker';
|
|
|
9
9
|
import { latencyTracker } from '../../application/latencyTracker';
|
|
10
10
|
import { getTaskErrorStats } from '../../application/backgroundTasks';
|
|
11
11
|
import { VERSION } from '../../shared/version';
|
|
12
|
+
import { clientStorageStatus } from '../../shared/storageHealth';
|
|
12
13
|
import { cloudLog } from './logger';
|
|
13
|
-
import { SNAPSHOT_HOST, SNAPSHOT_RUNTIME,
|
|
14
|
-
import {
|
|
14
|
+
import { SNAPSHOT_HOST, SNAPSHOT_RUNTIME, enrichFailedJobDurations, mapSnapshotCrons, mapSnapshotJobArtifacts, mapSnapshotWorkers, resolveRedaction, } from './snapshot/collector';
|
|
15
|
+
import { collectWebhooks, collectQueueThroughput, collectDurationHistogram, collectQueueWaitTime, collectQueueRetryRate, collectBacklogVelocity, collectStallDetails, collectPriorityDistribution, mapSnapshotDlqEntries, mapSnapshotJobs, mapSnapshotQueueConfigs, mapSnapshotTopErrors, mapSnapshotWorkerUtilization, } from './snapshotHelpers';
|
|
16
|
+
import { resolveCloudQueueAdapter } from './queueAdapter/registry';
|
|
15
17
|
/** Collect a snapshot. Light data always fresh, heavy data cached between refreshes. */
|
|
16
18
|
export async function collectSnapshot(params) {
|
|
17
19
|
const t0 = performance.now();
|
|
18
20
|
const { queueManager, instanceId, instanceName, startedAt, sequenceId, serverHandles } = params;
|
|
19
21
|
const { redactFields, includeJobData } = resolveRedaction(params);
|
|
22
|
+
const source = await resolveCloudQueueAdapter(queueManager).readSnapshotSource();
|
|
20
23
|
// ─── MCP operations (drain buffer into snapshot) ───
|
|
21
24
|
const mcpData = serverHandles?.getMcpOperations?.();
|
|
22
25
|
// ─── Light data (O(SHARD_COUNT), every snapshot) ───
|
|
23
|
-
const stats =
|
|
26
|
+
const stats = source.stats;
|
|
24
27
|
const memStats = queueManager.getMemoryStats();
|
|
25
|
-
const workerStats =
|
|
28
|
+
const workerStats = source.workerStats;
|
|
26
29
|
const rates = throughputTracker.getRates();
|
|
27
30
|
const percentiles = latencyTracker.getPercentiles();
|
|
28
31
|
const averages = latencyTracker.getAverages();
|
|
29
|
-
const storage = queueManager.getStorageStatus();
|
|
32
|
+
const storage = clientStorageStatus(queueManager.getStorageStatus());
|
|
30
33
|
const mem = process.memoryUsage();
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const queues = queueNames.flatMap((name) => {
|
|
34
|
-
const counts = countsByQueue.get(name);
|
|
35
|
-
if (!counts)
|
|
36
|
-
return [];
|
|
37
|
-
return {
|
|
38
|
-
name,
|
|
39
|
-
waiting: counts.waiting,
|
|
40
|
-
prioritized: counts.prioritized,
|
|
41
|
-
delayed: counts.delayed,
|
|
42
|
-
active: counts.active,
|
|
43
|
-
completed: counts.completed,
|
|
44
|
-
failed: counts.failed,
|
|
45
|
-
'waiting-children': counts['waiting-children'],
|
|
46
|
-
paused: queueManager.isPaused(name),
|
|
47
|
-
totalCompleted: counts.totalCompleted,
|
|
48
|
-
totalFailed: counts.totalFailed,
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
const crons = collectCrons(queueManager);
|
|
34
|
+
const queues = source.queues.map(({ name, counts, paused }) => ({ name, ...counts, paused }));
|
|
35
|
+
const crons = mapSnapshotCrons(source.crons);
|
|
52
36
|
// ─── Full data (every snapshot) ───
|
|
53
37
|
const allQueueNames = queues.map((q) => q.name);
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
38
|
+
const recentJobs = mapSnapshotJobs(source.jobs, {
|
|
39
|
+
redactFields,
|
|
40
|
+
includeJobData,
|
|
41
|
+
});
|
|
42
|
+
const dlqEntries = mapSnapshotDlqEntries(source.dlqEntries, {
|
|
57
43
|
redactFields,
|
|
58
44
|
includeJobData,
|
|
59
45
|
});
|
|
60
|
-
const dlqEntries = collectDlqEntries(queueManager, dlqQueues.map((q) => q.name), { redactFields, includeJobData });
|
|
61
46
|
enrichFailedJobDurations(recentJobs, dlqEntries);
|
|
62
|
-
const topErrors =
|
|
63
|
-
const workerDetails =
|
|
64
|
-
const queueConfigs =
|
|
47
|
+
const topErrors = mapSnapshotTopErrors(source.dlqEntries);
|
|
48
|
+
const workerDetails = mapSnapshotWorkers(source.workers, Date.now());
|
|
49
|
+
const queueConfigs = mapSnapshotQueueConfigs(source.queues);
|
|
65
50
|
const webhooks = collectWebhooks(queueManager);
|
|
66
51
|
const s3Backup = serverHandles?.getBackupStatus?.() ?? null;
|
|
67
52
|
const telemetry = queueManager.getCloudTelemetry(allQueueNames);
|
|
68
|
-
const { jobResults, jobLogEntries, activeLocks } =
|
|
53
|
+
const { jobResults, jobLogEntries, activeLocks } = mapSnapshotJobArtifacts(source);
|
|
69
54
|
const result = {
|
|
70
55
|
instanceId,
|
|
71
56
|
instanceName,
|
|
@@ -126,7 +111,7 @@ export async function collectSnapshot(params) {
|
|
|
126
111
|
// Analytics
|
|
127
112
|
queueThroughput: collectQueueThroughput(queues),
|
|
128
113
|
durationHistogram: collectDurationHistogram(recentJobs),
|
|
129
|
-
workerUtilization:
|
|
114
|
+
workerUtilization: mapSnapshotWorkerUtilization(source.workers),
|
|
130
115
|
sqliteStats: serverHandles?.getSqliteStats?.() ?? null,
|
|
131
116
|
runtime: SNAPSHOT_RUNTIME,
|
|
132
117
|
queueWaitTime: collectQueueWaitTime(recentJobs),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { collectBacklogVelocity, collectDurationHistogram, collectPriorityDistribution, collectQueueRetryRate, collectQueueThroughput, collectQueueWaitTime, collectWorkerUtilization, } from './snapshot/analytics';
|
|
2
|
-
export { collectQueueConfigs, collectTopErrors, collectWebhooks } from './snapshot/config';
|
|
3
|
-
export { collectDlqEntries, collectLiveJobs } from './snapshot/jobs';
|
|
1
|
+
export { collectBacklogVelocity, collectDurationHistogram, collectPriorityDistribution, collectQueueRetryRate, collectQueueThroughput, collectQueueWaitTime, collectWorkerUtilization, mapSnapshotWorkerUtilization, } from './snapshot/analytics';
|
|
2
|
+
export { collectQueueConfigs, collectTopErrors, collectWebhooks, mapSnapshotQueueConfigs, mapSnapshotTopErrors, } from './snapshot/config';
|
|
3
|
+
export { collectDlqEntries, collectLiveJobs, mapSnapshotDlqEntries, mapSnapshotJobs, } from './snapshot/jobs';
|
|
4
4
|
export { collectStallDetails } from './snapshot/stalls';
|
|
5
5
|
export type { RedactOptions } from './types/redact';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { collectBacklogVelocity, collectDurationHistogram, collectPriorityDistribution, collectQueueRetryRate, collectQueueThroughput, collectQueueWaitTime, collectWorkerUtilization, } from './snapshot/analytics';
|
|
2
|
-
export { collectQueueConfigs, collectTopErrors, collectWebhooks } from './snapshot/config';
|
|
3
|
-
export { collectDlqEntries, collectLiveJobs } from './snapshot/jobs';
|
|
1
|
+
export { collectBacklogVelocity, collectDurationHistogram, collectPriorityDistribution, collectQueueRetryRate, collectQueueThroughput, collectQueueWaitTime, collectWorkerUtilization, mapSnapshotWorkerUtilization, } from './snapshot/analytics';
|
|
2
|
+
export { collectQueueConfigs, collectTopErrors, collectWebhooks, mapSnapshotQueueConfigs, mapSnapshotTopErrors, } from './snapshot/config';
|
|
3
|
+
export { collectDlqEntries, collectLiveJobs, mapSnapshotDlqEntries, mapSnapshotJobs, } from './snapshot/jobs';
|
|
4
4
|
export { collectStallDetails } from './snapshot/stalls';
|
|
@@ -7,6 +7,7 @@ import { hostname, arch, platform, cpus } from 'os';
|
|
|
7
7
|
import { throughputTracker } from '../../application/throughputTracker';
|
|
8
8
|
import { latencyTracker } from '../../application/latencyTracker';
|
|
9
9
|
import { VERSION } from '../../shared/version';
|
|
10
|
+
import { clientStorageStatus } from '../../shared/storageHealth';
|
|
10
11
|
/** Cached hostname — computed once */
|
|
11
12
|
const HOST = hostname();
|
|
12
13
|
/** Cached runtime info — computed once */
|
|
@@ -22,7 +23,7 @@ export function buildStatsRefresh(qm) {
|
|
|
22
23
|
const rates = throughputTracker.getRates();
|
|
23
24
|
const percentiles = latencyTracker.getPercentiles();
|
|
24
25
|
const averages = latencyTracker.getAverages();
|
|
25
|
-
const storage = qm.getStorageStatus();
|
|
26
|
+
const storage = clientStorageStatus(qm.getStorageStatus());
|
|
26
27
|
const mem = process.memoryUsage();
|
|
27
28
|
const workerStats = qm.workerManager.getStats();
|
|
28
29
|
const queueNames = qm.listQueues();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CloudQueueAdapter } from '../queueAdapter/types';
|
|
2
2
|
import type { CloudSnapshot } from './snapshot';
|
|
3
3
|
/** Incoming command from the dashboard. */
|
|
4
4
|
export interface CloudCommand {
|
|
@@ -41,4 +41,4 @@ export interface CommandContext {
|
|
|
41
41
|
getSnapshot?: () => Promise<CloudSnapshot>;
|
|
42
42
|
triggerBackup?: () => Promise<unknown>;
|
|
43
43
|
}
|
|
44
|
-
export type CloudCommandHandler = (
|
|
44
|
+
export type CloudCommandHandler = (adapter: CloudQueueAdapter, command: CloudCommand, context?: CommandContext) => unknown;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TransactionSQL } from 'bun';
|
|
2
|
+
import { type Job, type JobId } from '../../../domain/types/job';
|
|
3
|
+
import { type PostgresContext } from './context';
|
|
4
|
+
import type { PostgresAdmissionResult } from './admissionResult';
|
|
5
|
+
export interface AdmitPostgresJobOptions {
|
|
6
|
+
readonly rejectExisting?: boolean;
|
|
7
|
+
readonly linkParent?: boolean;
|
|
8
|
+
readonly dependencyLocksHeld?: boolean;
|
|
9
|
+
readonly queueLifecycleLocksHeld?: boolean;
|
|
10
|
+
readonly dependencyExistenceCheckDeferred?: boolean;
|
|
11
|
+
readonly completionConsumerExemptions?: readonly JobId[];
|
|
12
|
+
/** Flow caller already holds identity locks and batches completion, queue, and event writes. */
|
|
13
|
+
readonly preparedFlow?: {
|
|
14
|
+
readonly now: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** Insert one job inside the caller's transaction and return its authoritative generation. */
|
|
18
|
+
export declare function admitPostgresJob(tx: TransactionSQL, ctx: PostgresContext, job: Job, options?: AdmitPostgresJobOptions): Promise<PostgresAdmissionResult>;
|