in appender.go [679:707]
func (a *Appender) maybeScaleUp(now time.Time, info scalingInfo, fullFlush *uint) bool {
if *fullFlush < a.config.Scaling.ScaleUp.Threshold {
return false
}
if info.activeIndexers >= a.activeLimit() {
return false
}
// Reset fullFlush after it has exceeded the threshold
// it avoids unnecessary precociousness to scale up.
*fullFlush = 0
// If more than 1% of the requests result in 429, do not scale up.
if a.indexFailureRate() >= 0.01 {
return false
}
if info.withinCoolDown(a.config.Scaling.ScaleUp.CoolDown, now) {
return false
}
// Avoid having more than 1 concurrent upscale, by using a compare
// and swap operation.
if newInfo := info.ScaleUp(now); a.scalingInfo.CompareAndSwap(info, newInfo) {
a.config.Logger.Info(
"full flush threshold exceeded, scaling up",
zap.Int64("old_active_indexer_count", info.activeIndexers),
zap.Int64("new_active_indexer_count", newInfo.activeIndexers),
)
return true
}
return false
}