diff --git a/common/metrics/defs.go b/common/metrics/defs.go index 97bbc56c59a..78e590892d2 100644 --- a/common/metrics/defs.go +++ b/common/metrics/defs.go @@ -2154,6 +2154,8 @@ const ( NoopImplementationIsUsed + ClosedWorkflowBufferEventCount + NumCommonMetrics // Needs to be last on this list for iota numbering ) @@ -2636,6 +2638,8 @@ var MetricDefs = map[ServiceIdx]map[int]metricDefinition{ ElasticsearchDocumentGenerateFailuresCount: NewCounterDef("elasticsearch_document_generate_failures_counter"), NoopImplementationIsUsed: NewCounterDef("noop_implementation_is_used"), + + ClosedWorkflowBufferEventCount: NewCounterDef("closed_workflow_buffer_event_counter"), }, History: { TaskRequests: NewCounterDef("task_requests"), diff --git a/service/history/workflow/context.go b/service/history/workflow/context.go index c52c2f2d0a0..b2a757e10e5 100644 --- a/service/history/workflow/context.go +++ b/service/history/workflow/context.go @@ -680,7 +680,8 @@ func (c *ContextImpl) SetWorkflowExecution(ctx context.Context, now time.Time) ( return err } if len(resetWorkflowEventsSeq) != 0 { - return serviceerror.NewInternal("SetWorkflowExecution encountered new events") + c.metricsClient.IncCounter(metrics.WorkflowContextScope, metrics.ClosedWorkflowBufferEventCount) + c.logger.Warn("SetWorkflowExecution encountered new events") } resetWorkflowSnapshot.ExecutionInfo.ExecutionStats = &persistencespb.ExecutionStats{