Repository navigation
Dashboard: runtime-status failure in WorkflowDashboardContributor discards instance metrics #8591
Description
Summary
In WorkflowDashboardContributor, an exception from runtime status (IWorkflowRuntimeAdminService.GetStatus()) also wipes out the workflow instance metrics, even when the instance store is healthy. The overview still returns 200 OK, but workflowInstances comes back as Unavailable with no figures. Instance-based findings are dropped from Needs Attention the same way. The two data sources are independent, so a failure in one should not hide the other.
Greptile flagged this on #8586 as an outside-diff P2 ("Runtime-status failure prevents independent instance metrics"). Code Review ruled that it is backend code from #8572, already on main and not #8586's to fix, and asked for it to be tracked separately. The coupling predates #8572. Before #8572 the store was skipped too, but the zero metrics were wrongly reported as Available.
Repro / Where
src/modules/Elsa.Workflows.Runtime.Dashboard/Dashboard/WorkflowDashboardContributor.cs (main):
GetOverviewAsynccallsGetRuntimeStatus()first, outside thetry/catchthat guardsGetWorkflowMetricsAsync. The instance store's catch only covers instance metrics.GetFindingsAsyncalso callsGetRuntimeStatus()beforeTryGetWorkflowMetricsAsync, with no guard.DefaultDashboardProvidercatches the exception that escapes and treats the whole contributor as failed (catch { return default; }). The merge rule then marks every section that contributor declared, includingWorkflowInstances, as Unavailable.
Repro (unit): make runtimeAdminService.GetStatus() throw, let the instance store return counts, and call DefaultDashboardProvider.GetOverviewAsync as a caller who has workflows/runtime:view and workflows/instances:view. Result: WorkflowInstances is Unavailable with zero figures.
Expected
- If runtime status fails, only the runtime section is Unavailable. Instance metrics and instance findings are still returned when the store works.
- This mirrors the existing behaviour for the opposite case, where an instance store outage leaves runtime status intact.
Suggested fix
- Wrap
GetRuntimeStatus()in its own guard, for example aTryGetRuntimeStatus()that returns an UnavailableDashboardRuntimeStatusornulland does not catchOperationCanceledException. Use it in bothGetOverviewAsyncandGetFindingsAsync. - In
GetFindingsAsync, skip the runtime findings when runtime status is unavailable, and still evaluate the instance findings. - Check that the provider's per-section merge accepts a contribution where runtime is Unavailable and instances are Available. If it doesn't, add a runtime
isFailedpath. - Tests:
- runtime throws and the store works: overview has instance metrics and runtime is Unavailable;
- findings still include
workflow-faults/workflow-incidents; - the existing test where the store throws and runtime is kept still passes.
- If 3.9.x needs this, backport it to
release/3.9.0.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsReady
Activity