Skip to content

Commit

Permalink
FIX logic better
Browse files Browse the repository at this point in the history
Signed-off-by: yomek33 <i3landme@gmail.com>
  • Loading branch information
yomek33 committed Aug 6, 2024
1 parent 47eeb45 commit 84b0abb
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 84b0abb

Please sign in to comment.