mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
lib/writeconcurrencylimiter: initialize concurrencyLimitCh before exporting vm_concurrent_insert_capacity
and vm_concurrent_insert_current
metrics
This will result in proper calculations for the the alerting rule: avg_over_time(vm_concurrent_insert_current[1m]) >= vm_concurrent_insert_capacity See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3761
This commit is contained in:
parent
f2be447270
commit
67b01329a0
1 changed files with 2 additions and 0 deletions
|
@ -126,9 +126,11 @@ var (
|
||||||
concurrencyLimitTimeout = metrics.NewCounter(`vm_concurrent_insert_limit_timeout_total`)
|
concurrencyLimitTimeout = metrics.NewCounter(`vm_concurrent_insert_limit_timeout_total`)
|
||||||
|
|
||||||
_ = metrics.NewGauge(`vm_concurrent_insert_capacity`, func() float64 {
|
_ = metrics.NewGauge(`vm_concurrent_insert_capacity`, func() float64 {
|
||||||
|
concurrencyLimitChOnce.Do(initConcurrencyLimitCh)
|
||||||
return float64(cap(concurrencyLimitCh))
|
return float64(cap(concurrencyLimitCh))
|
||||||
})
|
})
|
||||||
_ = metrics.NewGauge(`vm_concurrent_insert_current`, func() float64 {
|
_ = metrics.NewGauge(`vm_concurrent_insert_current`, func() float64 {
|
||||||
|
concurrencyLimitChOnce.Do(initConcurrencyLimitCh)
|
||||||
return float64(len(concurrencyLimitCh))
|
return float64(len(concurrencyLimitCh))
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue