Skip to content

Commit 6f53808

Browse files
authored
Log flow pause/resume/resync/update (#4210)
To help debug the historical cases. They're technically reflected in stdout logs but if an action is submitted through the UI it makes sense to reflect it in UI-facing logs as well. Restrictions: * Not logging entries on create flow/create peer as the flow doesn't technically exist yet * Logging when the signal was submitted and now when it was received, as the workflow code is not supposed to do network calls
1 parent 113f9a1 commit 6f53808

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

flow/cmd/handler.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ func (h *FlowRequestHandler) FlowStateChange(
460460
return nil, NewInternalApiError(fmt.Errorf("unable to signal workflow update: %w", err))
461461
}
462462
telemetry.LogActivityStartFlowConfigUpdate(ctx, req.FlowJobName, req.FlowConfigUpdate.GetCdcFlowConfigUpdate())
463+
h.alerter.LogFlowInfo(ctx, req.FlowJobName, "Flow config update signaled")
463464
}
464465

465466
slog.InfoContext(ctx, "[flow-state-change] received request", logs,
@@ -472,20 +473,23 @@ func (h *FlowRequestHandler) FlowStateChange(
472473
changeErr = model.FlowSignal.SignalClientWorkflow(ctx, h.temporalClient, workflowID, "", model.PauseSignal)
473474
if changeErr == nil {
474475
telemetry.LogActivityPauseFlow(ctx, req.FlowJobName)
476+
h.alerter.LogFlowInfo(ctx, req.FlowJobName, "Mirror pause signaled")
475477
}
476478
}
477479
case protos.FlowStatus_STATUS_RUNNING:
478480
if currState == protos.FlowStatus_STATUS_PAUSED {
479481
changeErr = model.FlowSignal.SignalClientWorkflow(ctx, h.temporalClient, workflowID, "", model.NoopSignal)
480482
if changeErr == nil {
481483
telemetry.LogActivityResumeFlow(ctx, req.FlowJobName)
484+
h.alerter.LogFlowInfo(ctx, req.FlowJobName, "Mirror resume signaled")
482485
}
483486
}
484487
case protos.FlowStatus_STATUS_RESYNC:
485488
if currState == protos.FlowStatus_STATUS_COMPLETED || currState == protos.FlowStatus_STATUS_FAILED {
486489
changeErr = h.resyncByRecreatingFlow(ctx, req.FlowJobName, req.DropMirrorStats)
487490
if changeErr == nil {
488491
telemetry.LogActivityResyncFlow(ctx, req.FlowJobName)
492+
h.alerter.LogFlowInfo(ctx, req.FlowJobName, "Mirror resync signaled")
489493
}
490494
} else if isCDC, err := h.isCDCFlow(ctx, req.FlowJobName); err != nil {
491495
return nil, NewInternalApiError(fmt.Errorf("unable to determine if mirror is cdc: %w", err))
@@ -510,6 +514,7 @@ func (h *FlowRequestHandler) FlowStateChange(
510514
changeErr = model.FlowSignalStateChange.SignalClientWorkflow(ctx, h.temporalClient, workflowID, "", req)
511515
if changeErr == nil {
512516
telemetry.LogActivityResyncFlow(ctx, req.FlowJobName)
517+
h.alerter.LogFlowInfo(ctx, req.FlowJobName, "Mirror resync signaled")
513518
}
514519
}
515520
case protos.FlowStatus_STATUS_TERMINATING, protos.FlowStatus_STATUS_TERMINATED:
@@ -524,6 +529,7 @@ func (h *FlowRequestHandler) FlowStateChange(
524529
}
525530
if changeErr == nil {
526531
telemetry.LogActivityTerminateFlow(ctx, req.FlowJobName)
532+
h.alerter.LogFlowInfo(ctx, req.FlowJobName, "Mirror termination signaled")
527533
}
528534
}
529535
default:

0 commit comments

Comments
 (0)