From 8b7484fd669bfe324e2f2630de054239869af2c6 Mon Sep 17 00:00:00 2001 From: Matt McShane Date: Wed, 31 May 2023 17:21:54 -0400 Subject: [PATCH] Add update counts to mutable state statistics --- common/persistence/dataInterfaces.go | 3 +++ common/persistence/size.go | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/common/persistence/dataInterfaces.go b/common/persistence/dataInterfaces.go index ef34af4640d..24d1d7769c1 100644 --- a/common/persistence/dataInterfaces.go +++ b/common/persistence/dataInterfaces.go @@ -733,6 +733,7 @@ type ( SignalInfoSize int SignalRequestIDSize int BufferedEventsSize int + // UpdateInfoSize is included in ExecutionInfoSize // Item count for various information captured within mutable state ActivityInfoCount int @@ -743,6 +744,7 @@ type ( SignalRequestIDCount int BufferedEventsCount int TaskCountByCategory map[string]int + UpdateInfoCount int // Total item count for various information captured within mutable state TotalActivityCount int64 @@ -751,6 +753,7 @@ type ( TotalRequestCancelExternalCount int64 TotalSignalExternalCount int64 TotalSignalCount int64 + TotalUpdateCount int64 } HistoryStatistics struct { diff --git a/common/persistence/size.go b/common/persistence/size.go index f21cbe2ec26..a945959febd 100644 --- a/common/persistence/size.go +++ b/common/persistence/size.go @@ -68,6 +68,9 @@ func statusOfInternalWorkflow( bufferedEventsCount := len(internalState.BufferedEvents) bufferedEventsSize := sizeOfBlobSlice(internalState.BufferedEvents) + totalUpdateCount := state.ExecutionInfo.UpdateCount + updateInfoCount := len(state.ExecutionInfo.UpdateInfos) + totalSize := executionInfoSize totalSize += executionStateSize totalSize += activityInfoSize @@ -111,6 +114,9 @@ func statusOfInternalWorkflow( BufferedEventsSize: bufferedEventsSize, BufferedEventsCount: bufferedEventsCount, + + UpdateInfoCount: updateInfoCount, + TotalUpdateCount: totalUpdateCount, } } @@ -161,6 +167,9 @@ func statusOfInternalWorkflowMutation( signalRequestIDSize := sizeOfStringSet(mutation.UpsertSignalRequestedIDs) signalRequestIDSize += sizeOfStringSet(mutation.DeleteSignalRequestedIDs) + totalUpdateCount := mutation.ExecutionInfo.UpdateCount + updateInfoCount := len(mutation.ExecutionInfo.UpdateInfos) + bufferedEventsCount := 0 bufferedEventsSize := 0 if mutation.NewBufferedEvents != nil { @@ -217,6 +226,9 @@ func statusOfInternalWorkflowMutation( BufferedEventsCount: bufferedEventsCount, TaskCountByCategory: taskCountByCategory, + + TotalUpdateCount: totalUpdateCount, + UpdateInfoCount: updateInfoCount, } } @@ -263,6 +275,9 @@ func statusOfInternalWorkflowSnapshot( signalRequestIDCount := len(snapshot.SignalRequestedIDs) signalRequestIDSize := sizeOfStringSet(snapshot.SignalRequestedIDs) + totalUpdateCount := snapshot.ExecutionInfo.UpdateCount + updateInfoCount := len(snapshot.ExecutionInfo.UpdateInfos) + bufferedEventsCount := 0 bufferedEventsSize := 0 @@ -313,5 +328,8 @@ func statusOfInternalWorkflowSnapshot( BufferedEventsCount: bufferedEventsCount, TaskCountByCategory: taskCountByCategory, + + TotalUpdateCount: totalUpdateCount, + UpdateInfoCount: updateInfoCount, } }