@onlineapps/conn-orch-orchestrator 1.0.45 → 1.0.47
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/WorkflowOrchestrator.js +27 -27
package/package.json
CHANGED
|
@@ -253,33 +253,9 @@ class WorkflowOrchestrator {
|
|
|
253
253
|
// Ignore - use default 0
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
//
|
|
257
|
-
//
|
|
258
|
-
|
|
259
|
-
try {
|
|
260
|
-
await publishToMonitoringWorkflow(this.mqClient, {
|
|
261
|
-
event_type: 'progress',
|
|
262
|
-
workflow_id: workflow_id,
|
|
263
|
-
service_name: serviceName,
|
|
264
|
-
step_index: failedStepIndex,
|
|
265
|
-
step_id: current_step,
|
|
266
|
-
cookbook: cookbookDef,
|
|
267
|
-
context: context,
|
|
268
|
-
output: null,
|
|
269
|
-
error: {
|
|
270
|
-
message: error.message,
|
|
271
|
-
attempt: attemptNumber
|
|
272
|
-
},
|
|
273
|
-
status: 'failed',
|
|
274
|
-
timestamp: new Date().toISOString()
|
|
275
|
-
}, this.logger, { workflow_id, step_id: current_step });
|
|
276
|
-
} catch (monitoringError) {
|
|
277
|
-
// Don't fail workflow if monitoring publish fails
|
|
278
|
-
this.logger.warn('Failed to publish failed step progress to monitoring', {
|
|
279
|
-
workflow_id,
|
|
280
|
-
error: monitoringError.message
|
|
281
|
-
});
|
|
282
|
-
}
|
|
256
|
+
// NOTE: We do NOT publish workflow_progress on every retry attempt.
|
|
257
|
+
// Instead, we publish ONE progress event at the end (either success or final failure with DLQ entry).
|
|
258
|
+
// This keeps the trace clean - one entry per step, with complete _dlq_history in context.
|
|
283
259
|
|
|
284
260
|
// Add attempt to DLQ history
|
|
285
261
|
const attemptRecord = {
|
|
@@ -368,6 +344,7 @@ class WorkflowOrchestrator {
|
|
|
368
344
|
error: error.stack
|
|
369
345
|
});
|
|
370
346
|
|
|
347
|
+
// Publish to workflow.failed (DLQ queue - message stays until manual requeue/discard)
|
|
371
348
|
await this.mqClient.publish('workflow.failed', {
|
|
372
349
|
workflow_id,
|
|
373
350
|
current_step,
|
|
@@ -382,6 +359,29 @@ class WorkflowOrchestrator {
|
|
|
382
359
|
failed_at: new Date().toISOString()
|
|
383
360
|
});
|
|
384
361
|
|
|
362
|
+
// ALSO publish to monitoring.workflow so dashboard shows the DLQ entry
|
|
363
|
+
// This is separate from the DLQ message - it's just for visibility
|
|
364
|
+
try {
|
|
365
|
+
await publishToMonitoringWorkflow(this.mqClient, {
|
|
366
|
+
event_type: 'failed',
|
|
367
|
+
workflow_id: workflow_id,
|
|
368
|
+
service_name: serviceName,
|
|
369
|
+
step_index: failedStepIndex,
|
|
370
|
+
step_id: current_step,
|
|
371
|
+
cookbook: cookbookDef,
|
|
372
|
+
context: finalContext,
|
|
373
|
+
error: { message: error.message },
|
|
374
|
+
status: 'failed',
|
|
375
|
+
timestamp: new Date().toISOString()
|
|
376
|
+
}, this.logger, { workflow_id, step_id: current_step });
|
|
377
|
+
} catch (monitoringError) {
|
|
378
|
+
// Don't fail if monitoring publish fails
|
|
379
|
+
this.logger.warn('[WorkflowOrchestrator] Failed to publish DLQ entry to monitoring', {
|
|
380
|
+
workflow_id,
|
|
381
|
+
error: monitoringError.message
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
|
|
385
385
|
console.log(`[WorkflowOrchestrator] [DLQ] ✓ Successfully published workflow.failed for ${workflow_id}`);
|
|
386
386
|
this.logger.info(`[WorkflowOrchestrator] [DLQ] ✓ Published workflow.failed: ${workflow_id}`);
|
|
387
387
|
} catch (publishError) {
|