Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: yomek33 <[email protected]>
  • Loading branch information
yomek33 committed Jul 24, 2024
1 parent bddbb3b commit a41aecf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions metrics/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,20 +176,20 @@ func handleDoubleHalveMode(metricCount, metricLength, metricCycle, seriesCycle i
}
}

func handleGradualChangeMode(metricCount, metricLength, metricCycle, seriesCycle int, labelKeys, labelValues []string, seriesChangeRate, maxSeriesCount, minSeriesCount int, changeSeriesTick *time.Ticker, updateNotify chan struct{}) {
currentSeriesCount := &minSeriesCount
func handleGradualChangeMode(metricCount, metricLength, metricCycle, seriesCycle int, labelKeys, labelValues []string, seriesChangeRate, maxSeriesCount, minSeriesCount int, seriesCount *int, changeSeriesTick *time.Ticker, updateNotify chan struct{}) {
*seriesCount = minSeriesCount
seriesIncrease := true

for tick := range changeSeriesTick.C {
metricsMux.Lock()
unregisterMetrics()
registerMetrics(metricCount, metricLength, metricCycle, labelKeys)
cycleValues(labelKeys, labelValues, *currentSeriesCount, seriesCycle)
cycleValues(labelKeys, labelValues, *seriesCount, seriesCycle)
metricsMux.Unlock()

changeSeriesGradual(&seriesChangeRate, &maxSeriesCount, &minSeriesCount, currentSeriesCount, &seriesIncrease)
changeSeriesGradual(&seriesChangeRate, &maxSeriesCount, &minSeriesCount, seriesCount, &seriesIncrease)

fmt.Printf("%v: Adjusting series count. New count: %d\n", tick, *currentSeriesCount)
fmt.Printf("%v: Adjusting series count. New count: %d\n", tick, *seriesCount)

select {
case updateNotify <- struct{}{}:
Expand Down Expand Up @@ -241,7 +241,7 @@ func RunMetrics(metricCount, labelCount, seriesCount, seriesChangeRate, maxSerie
}
registerMetrics(metricCount, metricLength, metricCycle, labelKeys)
cycleValues(labelKeys, labelValues, minSeriesCount, seriesCycle)
go handleGradualChangeMode(metricCount, metricLength, metricCycle, seriesCycle, labelKeys, labelValues, seriesChangeRate, maxSeriesCount, minSeriesCount, changeSeriesTick, updateNotify)
go handleGradualChangeMode(metricCount, metricLength, metricCycle, seriesCycle, labelKeys, labelValues, seriesChangeRate, maxSeriesCount, minSeriesCount, &currentSeriesCount, changeSeriesTick, updateNotify)
go handleValueTicks(&labelKeys, &labelValues, &currentSeriesCount, &seriesCycle, updateNotify, valueTick)
go handleSeriesTicks(&labelKeys, &labelValues, &currentSeriesCount, &seriesCycle, updateNotify, seriesTick)

Expand Down

0 comments on commit a41aecf

Please sign in to comment.