[v10.4.x] Alerting: Clamp Loki ASH range query to configured max_query_length (#84607)
Alerting: Clamp Loki ASH range query to configured max_query_length (#83986)
* Clamp range in loki http client to configured max_query_length
Defaults to 721h to match Loki default
(cherry picked from commit 97f37b2e6f)
Co-authored-by: William Wernert <william.wernert@grafana.com>
This commit is contained in:
co-authored by
William Wernert
parent
819b5291af
commit
565368e39d
@@ -61,6 +61,7 @@ const (
|
||||
// DefaultRuleEvaluationInterval indicates a default interval of for how long a rule should be evaluated to change state from Pending to Alerting
|
||||
DefaultRuleEvaluationInterval = SchedulerBaseInterval * 6 // == 60 seconds
|
||||
stateHistoryDefaultEnabled = true
|
||||
lokiDefaultMaxQueryLength = 721 * time.Hour // 30d1h, matches the default value in Loki
|
||||
)
|
||||
|
||||
type UnifiedAlertingSettings struct {
|
||||
@@ -136,6 +137,7 @@ type UnifiedAlertingStateHistorySettings struct {
|
||||
// if one of them is set.
|
||||
LokiBasicAuthPassword string
|
||||
LokiBasicAuthUsername string
|
||||
LokiMaxQueryLength time.Duration
|
||||
MultiPrimary string
|
||||
MultiSecondaries []string
|
||||
ExternalLabels map[string]string
|
||||
@@ -405,6 +407,7 @@ func (cfg *Cfg) ReadUnifiedAlertingSettings(iniFile *ini.File) error {
|
||||
LokiTenantID: stateHistory.Key("loki_tenant_id").MustString(""),
|
||||
LokiBasicAuthUsername: stateHistory.Key("loki_basic_auth_username").MustString(""),
|
||||
LokiBasicAuthPassword: stateHistory.Key("loki_basic_auth_password").MustString(""),
|
||||
LokiMaxQueryLength: stateHistory.Key("loki_max_query_length").MustDuration(lokiDefaultMaxQueryLength),
|
||||
MultiPrimary: stateHistory.Key("primary").MustString(""),
|
||||
MultiSecondaries: splitTrim(stateHistory.Key("secondaries").MustString(""), ","),
|
||||
ExternalLabels: stateHistoryLabels.KeysHash(),
|
||||
|
||||
Reference in New Issue
Block a user