@@ -52,7 +52,7 @@ const (
52
52
53
53
noRetryBackoff = time .Duration (- 1 )
54
54
55
- historySizeEstimationOffset = 1 * 100
55
+ historySizeEstimationOffset = 1 * 1024
56
56
)
57
57
58
58
type (
@@ -305,13 +305,12 @@ func (eh *history) verifyAllEventsProcessed() error {
305
305
}
306
306
307
307
func (eh * history ) nextDecisionEvents () (nextEvents []* s.HistoryEvent , markers []* s.HistoryEvent , historySizeEstimation int , err error ) {
308
- historySizeEstimation = estimateHistorySize (eh .loadedEvents )
309
308
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 " )
311
310
if err := eh .verifyAllEventsProcessed (); err != nil {
312
- return nil , nil , historySizeEstimation , err
311
+ return nil , nil , 0 , err
313
312
}
314
- return []* s.HistoryEvent {}, []* s.HistoryEvent {}, historySizeEstimation , nil
313
+ return []* s.HistoryEvent {}, []* s.HistoryEvent {}, 0 , nil
315
314
}
316
315
317
316
// Process events
@@ -971,7 +970,8 @@ ProcessEvents:
971
970
zap .Int ("HistoryEstimation" , historySizeEstimation ),
972
971
zap .Int64 ("HistorySizeEstimation" , w .workflowInfo .TotalHistoryBytes ),
973
972
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 ))
975
975
w .wth .metricsScope .GetTaggedScope ("workflowtype" , w .workflowInfo .WorkflowType .Name ).Gauge ("cadence-server-historysize" ).Update (float64 (w .workflowInfo .HistoryBytesServer ))
976
976
w .wth .metricsScope .GetTaggedScope ("workflowtype" , w .workflowInfo .WorkflowType .Name ).Gauge ("cadence-client-historysize" ).Update (float64 (historySizeEstimation ))
977
977
if err != nil {
0 commit comments