Skip to content

Commit 5ff41f1

Browse files
committed
Change buffer size to 1024 and add logger tag for workflowtype
1 parent aac2f9b commit 5ff41f1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

internal/internal_task_handlers.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const (
5252

5353
noRetryBackoff = time.Duration(-1)
5454

55-
historySizeEstimationOffset = 1 * 100
55+
historySizeEstimationOffset = 1 * 1024
5656
)
5757

5858
type (
@@ -305,13 +305,12 @@ func (eh *history) verifyAllEventsProcessed() error {
305305
}
306306

307307
func (eh *history) nextDecisionEvents() (nextEvents []*s.HistoryEvent, markers []*s.HistoryEvent, historySizeEstimation int, err error) {
308-
historySizeEstimation = estimateHistorySize(eh.loadedEvents)
309308
if eh.currentIndex == len(eh.loadedEvents) && !eh.hasMoreEvents() {
310-
eh.eventsHandler.logger.Info("Returning 0 for historySizeEstimation")
309+
eh.eventsHandler.logger.Info("Returning 0 for historySizeEstimation since none will be processed")
311310
if err := eh.verifyAllEventsProcessed(); err != nil {
312-
return nil, nil, historySizeEstimation, err
311+
return nil, nil, 0, err
313312
}
314-
return []*s.HistoryEvent{}, []*s.HistoryEvent{}, historySizeEstimation, nil
313+
return []*s.HistoryEvent{}, []*s.HistoryEvent{}, 0, nil
315314
}
316315

317316
// Process events
@@ -971,7 +970,8 @@ ProcessEvents:
971970
zap.Int("HistoryEstimation", historySizeEstimation),
972971
zap.Int64("HistorySizeEstimation", w.workflowInfo.TotalHistoryBytes),
973972
zap.Int64("ActualHistorySize", w.workflowInfo.HistoryBytesServer),
974-
zap.Int64("HistorySizeDiff", w.workflowInfo.TotalHistoryBytes-w.workflowInfo.HistoryBytesServer))
973+
zap.Int64("HistorySizeDiff", w.workflowInfo.TotalHistoryBytes-w.workflowInfo.HistoryBytesServer),
974+
zap.String("workflowType", w.workflowInfo.WorkflowType.Name))
975975
w.wth.metricsScope.GetTaggedScope("workflowtype", w.workflowInfo.WorkflowType.Name).Gauge("cadence-server-historysize").Update(float64(w.workflowInfo.HistoryBytesServer))
976976
w.wth.metricsScope.GetTaggedScope("workflowtype", w.workflowInfo.WorkflowType.Name).Gauge("cadence-client-historysize").Update(float64(historySizeEstimation))
977977
if err != nil {

0 commit comments

Comments
 (0)