Skip to content

Commit

Permalink
Warning log on new event during set workflow (#3508)
Browse files Browse the repository at this point in the history
* Warning log on new event during set workflow

* Add metrics for the error
  • Loading branch information
yux0 authored and dnr committed Oct 18, 2022
1 parent 9a427c2 commit 07ab3e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions common/metrics/defs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2154,6 +2154,8 @@ const (

NoopImplementationIsUsed

ClosedWorkflowBufferEventCount

NumCommonMetrics // Needs to be last on this list for iota numbering
)

Expand Down Expand Up @@ -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"),
Expand Down
3 changes: 2 additions & 1 deletion service/history/workflow/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 07ab3e1

Please # to comment.