@@ -52,7 +52,7 @@ const (
52
52
53
53
noRetryBackoff = time .Duration (- 1 )
54
54
55
- historySizeEstimationOffset = 1 * 1024
55
+ historySizeEstimationOffset = 1 * 100
56
56
)
57
57
58
58
type (
@@ -966,7 +966,14 @@ func (w *workflowExecutionContextImpl) ProcessWorkflowTask(workflowTask *workflo
966
966
ProcessEvents:
967
967
for {
968
968
reorderedEvents , markers , binaryChecksum , historySizeEstimation , err := reorderedHistory .NextDecisionEvents ()
969
- w .wth .logger .Info (fmt .Sprintf ("The size estimation of history events for workflow task: %v," , historySizeEstimation ))
969
+ w .workflowInfo .TotalHistoryBytes += int64 (historySizeEstimation )
970
+ w .wth .logger .Info ("Differences between history size estimation and actual size" ,
971
+ zap .Int ("HistoryEstimation" , historySizeEstimation ),
972
+ zap .Int64 ("HistorySizeEstimation" , w .workflowInfo .TotalHistoryBytes ),
973
+ zap .Int64 ("ActualHistorySize" , w .workflowInfo .HistoryBytesServer ),
974
+ zap .Int64 ("HistorySizeDiff" , w .workflowInfo .TotalHistoryBytes - w .workflowInfo .HistoryBytesServer ))
975
+ w .wth .metricsScope .GetTaggedScope ("workflowtype" , w .workflowInfo .WorkflowType .Name ).Gauge ("cadence-server-historysize" ).Update (float64 (w .workflowInfo .HistoryBytesServer ))
976
+ w .wth .metricsScope .GetTaggedScope ("workflowtype" , w .workflowInfo .WorkflowType .Name ).Gauge ("cadence-client-historysize" ).Update (float64 (historySizeEstimation ))
970
977
if err != nil {
971
978
return nil , err
972
979
}
@@ -1012,13 +1019,6 @@ ProcessEvents:
1012
1019
return nil , err
1013
1020
}
1014
1021
1015
- w .workflowInfo .TotalHistoryBytes += int64 (historySizeEstimation )
1016
- w .wth .logger .Info ("DIfferences between history size estimation and actual size" ,
1017
- zap .Int ("HistoryEstimation" , historySizeEstimation ),
1018
- zap .Int64 ("HistorySizeEstimation" , w .workflowInfo .TotalHistoryBytes ),
1019
- zap .Int64 ("ActualHistorySize" , w .workflowInfo .HistoryBytesServer ),
1020
- zap .Int64 ("HistorySizeDiff" , w .workflowInfo .TotalHistoryBytes - w .workflowInfo .HistoryBytesServer ))
1021
-
1022
1022
err = eventHandler .ProcessEvent (event , isInReplay , isLast )
1023
1023
if err != nil {
1024
1024
return nil , err
0 commit comments