Skip to content

Commit

Permalink
FIX logic better
Browse files Browse the repository at this point in the history
Signed-off-by: yomek33 <[email protected]>
  • Loading branch information
yomek33 committed Aug 2, 2024
1 parent 045bfd5 commit e4a5e41
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions metrics/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ func handleGradualChangeMode(metricCount, metricLength, metricCycle, seriesCycle
}

func handleSpikeMode(metricCount, metricLength, metricCycle, seriesCycle int, labelKeys, labelValues []string, currentSeriesCount *int, spikeMultiplier float64, changeSeriesChan <-chan time.Time, updateNotify chan struct{}) {
inSpike := false
initialSeriesCount := *currentSeriesCount
for tick := range changeSeriesChan {
metricsMux.Lock()
Expand All @@ -208,11 +207,9 @@ func handleSpikeMode(metricCount, metricLength, metricCycle, seriesCycle int, la
cycleValues(labelKeys, labelValues, *currentSeriesCount, seriesCycle)
metricsMux.Unlock()

if inSpike {
inSpike = false
if *currentSeriesCount > initialSeriesCount {
*currentSeriesCount = initialSeriesCount
} else {
inSpike = true
*currentSeriesCount = int(float64(initialSeriesCount) * spikeMultiplier)
}

Expand Down

0 comments on commit e4a5e41

Please sign in to comment.