Add execution per shard stats
@@ -150,6 +150,7 @@ type (
PercentageCheckFailure float64
Rates Rates
CorruptionTypeBreakdown CorruptionTypeBreakdown
+ ShardExecutionCountsDistribution ShardExecutionCountsDistribution
}
// CorruptionTypeBreakdown breaks down counts and percentages of corruption types
@@ -170,6 +171,13 @@ type (
ShardsPerHour float64
ExecutionsPerHour float64
}
+
+ // ShardExecutionCountsDistribution breaks down stats on the distribution of executions per shard
+ ShardExecutionCountsDistribution struct {
+ MinExecutions *int64
+ MaxExecutions *int64
+ AverageExecutions int64
+ }
)
// AdminDBScan is used to scan over all executions in database and detect corruptions
@@ -739,6 +747,15 @@ func includeShardInProgressReport(report *ShardScanReport, progressReport *Progr
progressReport.CorruptionTypeBreakdown.TotalHistoryMissing += report.Scanned.CorruptionTypeBreakdown.TotalHistoryMissing
progressReport.CorruptionTypeBreakdown.TotalOpenExecutionInvalidCurrentExecution += report.Scanned.CorruptionTypeBreakdown.TotalOpenExecutionInvalidCurrentExecution
progressReport.CorruptionTypeBreakdown.TotalInvalidFirstEvent += report.Scanned.CorruptionTypeBreakdown.TotalInvalidFirstEvent
+ if progressReport.ShardExecutionCountsDistribution.MinExecutions == nil ||
+ *progressReport.ShardExecutionCountsDistribution.MinExecutions > report.Scanned.TotalExecutionsCount {
+ progressReport.ShardExecutionCountsDistribution.MinExecutions = &report.Scanned.TotalExecutionsCount
+ }
+ if progressReport.ShardExecutionCountsDistribution.MaxExecutions == nil ||
+ *progressReport.ShardExecutionCountsDistribution.MaxExecutions < report.Scanned.TotalExecutionsCount {
+ progressReport.ShardExecutionCountsDistribution.MaxExecutions = &report.Scanned.TotalExecutionsCount
+ }
+ progressReport.ShardExecutionCountsDistribution.AverageExecutions = progressReport.TotalExecutionsCount / int64(progressReport.NumberOfShardsFinished)
}
if progressReport.TotalExecutionsCount > 0 {
