Skip to content

Commit 16f7688

Browse files
authored
Add log for slow replication tasks (#8225)
## What changed? Log replication task details when processing takes too long ## Why? For operator investigation ## How did you test it? - [x] built - [x] run locally and tested manually - [x] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s) ## Potential risks no risk.
1 parent 934c58d commit 16f7688

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

service/history/replication/executable_task.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,11 +301,20 @@ func (e *ExecutableTaskImpl) emitFinishMetrics(
301301
if item != nil {
302302
nsTag = metrics.NamespaceTag(item.(namespace.Name).String())
303303
}
304+
processingLatency := now.Sub(e.taskReceivedTime)
304305
metrics.ReplicationTaskProcessingLatency.With(e.MetricsHandler).Record(
305-
now.Sub(e.taskReceivedTime),
306+
processingLatency,
306307
metrics.OperationTag(e.metricsTag),
307308
nsTag,
308309
)
310+
if processingLatency > 30*time.Second {
311+
e.Logger.Warn("replication task processing latency is too long",
312+
tag.WorkflowNamespaceID(e.replicationTask.RawTaskInfo.NamespaceId),
313+
tag.WorkflowID(e.replicationTask.RawTaskInfo.WorkflowId),
314+
tag.WorkflowRunID(e.replicationTask.RawTaskInfo.RunId),
315+
tag.ReplicationTask(e.replicationTask.GetRawTaskInfo()),
316+
)
317+
}
309318

310319
metrics.ReplicationLatency.With(e.MetricsHandler).Record(
311320
now.Sub(e.taskCreationTime),

0 commit comments

Comments
 (0)