Skip to content

Commit e64d2eb

Browse files
roth-wineroth-wine
roth-wine
authored andcommitted
ruler: Add flag to configure the queue for pending Alertmanager notifications
In the [prometheus package](https://github.com/prometheus/prometheus/blob/7789ef 27c838a567edd65b5fb767d4a35cab91ac/cmd/prometheus/main.go#L532) we are already a ble to configure the capacity size. The fixed value could lead to issues sending alerts when evaluating a huge amount of alerts in one ruler instance. Signed-off-by: roth-wine <[email protected]>
1 parent 2a5a856 commit e64d2eb

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
1414
- [#8225](https://github.com/thanos-io/thanos/pull/8225) tools: Extend bucket ls options.
1515

1616
### Added
17+
- [#8234](https://github.com/thanos-io/thanos/pull/8234) ruler: Add flag to configure the queue for pending Alertmanager notifications
1718

1819
### Changed
1920

cmd/thanos/rule.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ type ruleConfig struct {
109109
ignoredLabelNames []string
110110
storeRateLimits store.SeriesSelectLimits
111111
ruleConcurrentEval int64
112+
ruleQueueCapacity int
112113

113114
extendedFunctionsEnabled bool
114115
}
@@ -160,6 +161,7 @@ func registerRule(app *extkingpin.App) {
160161
cmd.Flag("restore-ignored-label", "Label names to be ignored when restoring alerts from the remote storage. This is only used in stateless mode.").
161162
StringsVar(&conf.ignoredLabelNames)
162163
cmd.Flag("rule-concurrent-evaluation", "How many rules can be evaluated concurrently. Default is 1.").Default("1").Int64Var(&conf.ruleConcurrentEval)
164+
cmd.Flag("rule-queue-capacity", "The capacity of the queue for pending Alertmanager notifications. Default is 10000").Default("10000").IntVar(&conf.ruleQueueCapacity)
163165

164166
cmd.Flag("grpc-query-endpoint", "Addresses of Thanos gRPC query API servers (repeatable). The scheme may be prefixed with 'dns+' or 'dnssrv+' to detect Thanos API servers through respective DNS lookups.").
165167
PlaceHolder("<endpoint>").StringsVar(&conf.grpcQueryEndpoints)
@@ -572,7 +574,7 @@ func runRule(
572574

573575
var (
574576
ruleMgr *thanosrules.Manager
575-
alertQ = alert.NewQueue(logger, reg, 10000, 100, labelsTSDBToProm(conf.lset), conf.alertmgr.alertExcludeLabels, alertRelabelConfigs)
577+
alertQ = alert.NewQueue(logger, reg, conf.ruleQueueCapacity, 100, labelsTSDBToProm(conf.lset), conf.alertmgr.alertExcludeLabels, alertRelabelConfigs)
576578
)
577579
{
578580
if conf.extendedFunctionsEnabled {

docs/components/rule.md

+3
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,9 @@ Flags:
477477
them.
478478
--rule-query-offset=0s The default rule group query_offset duration to
479479
use.
480+
--rule-queue-capacity=10000
481+
The capacity of the queue for pending
482+
Alertmanager notifications. Default is 10000
480483
--shipper.meta-file-name="thanos.shipper.json"
481484
the file to store shipper metadata in
482485
--shipper.upload-compacted

0 commit comments

Comments
 (0)