From 4acbe7200f7903334a3520e700815e26b14bc29f Mon Sep 17 00:00:00 2001 From: shantanualshi Date: Thu, 2 Nov 2023 17:12:40 +0530 Subject: [PATCH] Remove deprecated ruler_remote_write_relabel_configs, ruler_remote_write_queue_capacity and ruler_remote_write_sigv4_config --- docs/sources/configure/_index.md | 23 -------- docs/sources/operations/overrides-exporter.md | 1 - pkg/ruler/compat.go | 5 -- pkg/ruler/registry.go | 58 +------------------ pkg/validation/limits.go | 25 -------- pkg/validation/limits_test.go | 5 -- .../checker/checker_test.go | 9 --- .../deprecated-config.yaml | 3 - .../test-fixtures/config.yaml | 4 -- .../test-fixtures/runtime-config.yaml | 4 -- 10 files changed, 3 insertions(+), 134 deletions(-) diff --git a/docs/sources/configure/_index.md b/docs/sources/configure/_index.md index 23c11f58c0bbd..2f3a0140e39ba 100644 --- a/docs/sources/configure/_index.md +++ b/docs/sources/configure/_index.md @@ -2789,29 +2789,6 @@ The `limits_config` block configures global and per-tenant limits in Loki. # by Loki itself can't be overwritten. [ruler_remote_write_headers: ] -# Deprecated: Use 'ruler_remote_write_config' instead. List of remote write -# relabel configurations. -[ruler_remote_write_relabel_configs: ] - -# Deprecated: Use 'ruler_remote_write_config' instead. Number of samples to -# buffer per shard before we block reading of more samples from the WAL. It is -# recommended to have enough capacity in each shard to buffer several requests -# to keep throughput up while processing occasional slow remote requests. -[ruler_remote_write_queue_capacity: ] - -# Deprecated: Use 'ruler_remote_write_config' instead. Configures AWS's -# Signature Verification 4 signing process to sign every remote write request. -ruler_remote_write_sigv4_config: - [region: | default = ""] - - [access_key: | default = ""] - - [secret_key: | default = ""] - - [profile: | default = ""] - - [role_arn: | default = ""] - # Configures global and per-tenant limits for remote write clients. A map with # remote client id as key. [ruler_remote_write_config: ] diff --git a/docs/sources/operations/overrides-exporter.md b/docs/sources/operations/overrides-exporter.md index 505d5dfd5f2a0..be096ead1cce0 100644 --- a/docs/sources/operations/overrides-exporter.md +++ b/docs/sources/operations/overrides-exporter.md @@ -73,7 +73,6 @@ loki_overrides_defaults{limit_name="retention_period"} 2.6784e+15 loki_overrides_defaults{limit_name="ruler_evaluation_delay_duration"} 0 loki_overrides_defaults{limit_name="ruler_max_rule_groups_per_tenant"} 0 loki_overrides_defaults{limit_name="ruler_max_rules_per_rule_group"} 0 -loki_overrides_defaults{limit_name="ruler_remote_write_queue_capacity"} 0 loki_overrides_defaults{limit_name="split_queries_by_interval"} 0 ``` diff --git a/pkg/ruler/compat.go b/pkg/ruler/compat.go index 1f377d64a068d..4aebd9b12dde9 100644 --- a/pkg/ruler/compat.go +++ b/pkg/ruler/compat.go @@ -12,7 +12,6 @@ import ( "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" - "github.com/prometheus/common/sigv4" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/model/rulefmt" @@ -28,7 +27,6 @@ import ( "github.com/grafana/loki/pkg/logql/syntax" ruler "github.com/grafana/loki/pkg/ruler/base" "github.com/grafana/loki/pkg/ruler/rulespb" - "github.com/grafana/loki/pkg/ruler/util" ) // RulesLimits is the one function we need from limits.Overrides, and @@ -38,10 +36,7 @@ type RulesLimits interface { RulerRemoteWriteDisabled(userID string) bool RulerRemoteWriteHeaders(userID string) map[string]string - RulerRemoteWriteRelabelConfigs(userID string) []*util.RelabelConfig RulerRemoteWriteConfig(userID string, id string) *config.RemoteWriteConfig - RulerRemoteWriteQueueCapacity(userID string) int - RulerRemoteWriteSigV4Config(userID string) *sigv4.SigV4Config RulerRemoteEvaluationTimeout(userID string) time.Duration RulerRemoteEvaluationMaxResponseSize(userID string) int64 diff --git a/pkg/ruler/registry.go b/pkg/ruler/registry.go index 7062f6bf4d2fb..5982aa882db2f 100644 --- a/pkg/ruler/registry.go +++ b/pkg/ruler/registry.go @@ -9,6 +9,9 @@ import ( "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/grafana/dskit/user" + "github.com/grafana/loki/pkg/ruler/storage/cleaner" + "github.com/grafana/loki/pkg/ruler/storage/instance" + "github.com/grafana/loki/pkg/ruler/storage/wal" "github.com/imdario/mergo" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" @@ -17,13 +20,7 @@ import ( "github.com/prometheus/prometheus/model/histogram" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/model/metadata" - "github.com/prometheus/prometheus/model/relabel" "github.com/prometheus/prometheus/storage" - "gopkg.in/yaml.v2" - - "github.com/grafana/loki/pkg/ruler/storage/cleaner" - "github.com/grafana/loki/pkg/ruler/storage/instance" - "github.com/grafana/loki/pkg/ruler/storage/wal" ) type walRegistry struct { @@ -241,26 +238,6 @@ func (r *walRegistry) getTenantRemoteWriteConfig(tenant string, base RemoteWrite clt.Headers = v } - relabelConfigs, err := r.createRelabelConfigs(tenant) - if err != nil { - return nil, fmt.Errorf("failed to parse relabel configs: %w", err) - } - - // if any relabel configs are defined for a tenant, override all base relabel configs, - // even if an empty list is configured; however if this value is not overridden for a tenant, - // it should retain the base value - if relabelConfigs != nil { - clt.WriteRelabelConfigs = relabelConfigs - } - - if v := r.overrides.RulerRemoteWriteQueueCapacity(tenant); v > 0 { - clt.QueueConfig.Capacity = v - } - - if v := r.overrides.RulerRemoteWriteSigV4Config(tenant); v != nil { - clt.SigV4Config = v - } - if v := r.overrides.RulerRemoteWriteConfig(tenant, id); v != nil { // overwrite, do not merge if v.Headers != nil { @@ -286,35 +263,6 @@ func (r *walRegistry) getTenantRemoteWriteConfig(tenant string, base RemoteWrite return overrides, nil } -// createRelabelConfigs converts the util.RelabelConfig into relabel.Config to allow for -// more control over json/yaml unmarshaling -func (r *walRegistry) createRelabelConfigs(tenant string) ([]*relabel.Config, error) { - configs := r.overrides.RulerRemoteWriteRelabelConfigs(tenant) - - // zero value is nil, which we want to treat as "no override" - if configs == nil { - return nil, nil - } - - // we want to treat an empty slice as "no relabel configs" - relabelConfigs := make([]*relabel.Config, len(configs)) - for i, config := range configs { - out, err := yaml.Marshal(config) - if err != nil { - return nil, err - } - - var rc relabel.Config - if err = yaml.Unmarshal(out, &rc); err != nil { - return nil, err - } - - relabelConfigs[i] = &rc - } - - return relabelConfigs, nil -} - var errNotReady = errors.New("appender not ready") type notReadyAppender struct{} diff --git a/pkg/validation/limits.go b/pkg/validation/limits.go index d8350c16b1b52..9047c7c39641a 100644 --- a/pkg/validation/limits.go +++ b/pkg/validation/limits.go @@ -13,7 +13,6 @@ import ( "github.com/pkg/errors" "github.com/prometheus/common/model" - "github.com/prometheus/common/sigv4" "github.com/prometheus/prometheus/config" "github.com/prometheus/prometheus/model/labels" "golang.org/x/time/rate" @@ -23,7 +22,6 @@ import ( "github.com/grafana/loki/pkg/distributor/shardstreams" "github.com/grafana/loki/pkg/logql/syntax" ruler_config "github.com/grafana/loki/pkg/ruler/config" - "github.com/grafana/loki/pkg/ruler/util" "github.com/grafana/loki/pkg/util/flagext" util_log "github.com/grafana/loki/pkg/util/log" "github.com/grafana/loki/pkg/util/validation" @@ -129,12 +127,6 @@ type Limits struct { // deprecated use RulerRemoteWriteConfig instead RulerRemoteWriteHeaders OverwriteMarshalingStringMap `yaml:"ruler_remote_write_headers" json:"ruler_remote_write_headers" doc:"deprecated|description=Use 'ruler_remote_write_config' instead. Custom HTTP headers to be sent along with each remote write request. Be aware that headers that are set by Loki itself can't be overwritten."` - // deprecated use RulerRemoteWriteConfig instead - RulerRemoteWriteRelabelConfigs []*util.RelabelConfig `yaml:"ruler_remote_write_relabel_configs,omitempty" json:"ruler_remote_write_relabel_configs,omitempty" doc:"deprecated|description=Use 'ruler_remote_write_config' instead. List of remote write relabel configurations."` - // deprecated use RulerRemoteWriteConfig instead - RulerRemoteWriteQueueCapacity int `yaml:"ruler_remote_write_queue_capacity" json:"ruler_remote_write_queue_capacity" doc:"deprecated|description=Use 'ruler_remote_write_config' instead. Number of samples to buffer per shard before we block reading of more samples from the WAL. It is recommended to have enough capacity in each shard to buffer several requests to keep throughput up while processing occasional slow remote requests."` - // deprecated use RulerRemoteWriteConfig instead - RulerRemoteWriteSigV4Config *sigv4.SigV4Config `yaml:"ruler_remote_write_sigv4_config" json:"ruler_remote_write_sigv4_config" doc:"deprecated|description=Use 'ruler_remote_write_config' instead. Configures AWS's Signature Verification 4 signing process to sign every remote write request."` RulerRemoteWriteConfig map[string]config.RemoteWriteConfig `yaml:"ruler_remote_write_config,omitempty" json:"ruler_remote_write_config,omitempty" doc:"description=Configures global and per-tenant limits for remote write clients. A map with remote client id as key."` @@ -605,23 +597,6 @@ func (o *Overrides) RulerRemoteWriteHeaders(userID string) map[string]string { return o.getOverridesForUser(userID).RulerRemoteWriteHeaders.Map() } -// Deprecated: use RulerRemoteWriteConfig instead -// RulerRemoteWriteRelabelConfigs returns the write relabel configs to use in a remote-write for a given user. -func (o *Overrides) RulerRemoteWriteRelabelConfigs(userID string) []*util.RelabelConfig { - return o.getOverridesForUser(userID).RulerRemoteWriteRelabelConfigs -} - -// Deprecated: use RulerRemoteWriteConfig instead -// RulerRemoteWriteQueueCapacity returns the queue capacity to use in a remote-write for a given user. -func (o *Overrides) RulerRemoteWriteQueueCapacity(userID string) int { - return o.getOverridesForUser(userID).RulerRemoteWriteQueueCapacity -} - -// Deprecated: use RulerRemoteWriteConfig instead -func (o *Overrides) RulerRemoteWriteSigV4Config(userID string) *sigv4.SigV4Config { - return o.getOverridesForUser(userID).RulerRemoteWriteSigV4Config -} - // RulerRemoteWriteConfig returns the remote-write configurations to use for a given user and a given remote client. func (o *Overrides) RulerRemoteWriteConfig(userID string, id string) *config.RemoteWriteConfig { if c, ok := o.getOverridesForUser(userID).RulerRemoteWriteConfig[id]; ok { diff --git a/pkg/validation/limits_test.go b/pkg/validation/limits_test.go index 4e449e421c5a7..088ce6411a5a9 100644 --- a/pkg/validation/limits_test.go +++ b/pkg/validation/limits_test.go @@ -66,8 +66,6 @@ split_queries_by_interval: 190s ruler_evaluation_delay_duration: 200s ruler_max_rules_per_rule_group: 210 ruler_max_rule_groups_per_tenant: 220 -ruler_remote_write_sigv4_config: - region: us-east-1 per_tenant_override_config: "" per_tenant_override_period: 230s query_timeout: 5m @@ -111,9 +109,6 @@ volume_max_series: 10001 "ruler_evaluation_delay_duration": "200s", "ruler_max_rules_per_rule_group": 210, "ruler_max_rule_groups_per_tenant":220, - "ruler_remote_write_sigv4_config": { - "region": "us-east-1" - }, "per_tenant_override_config": "", "per_tenant_override_period": "230s", "query_timeout": "5m", diff --git a/tools/deprecated-config-checker/checker/checker_test.go b/tools/deprecated-config-checker/checker/checker_test.go index 74762db30a747..d5a8636d30e4b 100644 --- a/tools/deprecated-config-checker/checker/checker_test.go +++ b/tools/deprecated-config-checker/checker/checker_test.go @@ -48,9 +48,6 @@ var ( "limits_config.unordered_writes", "limits_config.ruler_evaluation_delay_duration", "limits_config.ruler_remote_write_headers", - "limits_config.ruler_remote_write_relabel_configs", - "limits_config.ruler_remote_write_queue_capacity", - "limits_config.ruler_remote_write_sigv4_config", "limits_config.per_tenant_override_config", "limits_config.per_tenant_override_period", "limits_config.allow_deletes", @@ -78,18 +75,12 @@ var ( "overrides.foo.unordered_writes", "overrides.foo.ruler_evaluation_delay_duration", "overrides.foo.ruler_remote_write_headers", - "overrides.foo.ruler_remote_write_relabel_configs", - "overrides.foo.ruler_remote_write_queue_capacity", - "overrides.foo.ruler_remote_write_sigv4_config", "overrides.foo.per_tenant_override_config", "overrides.foo.per_tenant_override_period", "overrides.foo.allow_deletes", "overrides.bar.unordered_writes", "overrides.bar.ruler_evaluation_delay_duration", "overrides.bar.ruler_remote_write_headers", - "overrides.bar.ruler_remote_write_relabel_configs", - "overrides.bar.ruler_remote_write_queue_capacity", - "overrides.bar.ruler_remote_write_sigv4_config", "overrides.bar.per_tenant_override_config", "overrides.bar.per_tenant_override_period", "overrides.bar.allow_deletes", diff --git a/tools/deprecated-config-checker/deprecated-config.yaml b/tools/deprecated-config-checker/deprecated-config.yaml index cd8096386f97a..90c5771ad556e 100644 --- a/tools/deprecated-config-checker/deprecated-config.yaml +++ b/tools/deprecated-config-checker/deprecated-config.yaml @@ -50,9 +50,6 @@ limits_config: unordered_writes: "Will be eventually removed." ruler_evaluation_delay_duration: "Will be eventually removed." ruler_remote_write_headers: "Use ruler_remote_write_config instead." - ruler_remote_write_relabel_configs: "Use ruler_remote_write_config instead." - ruler_remote_write_queue_capacity: "Use ruler_remote_write_config instead." - ruler_remote_write_sigv4_config: "Use ruler_remote_write_config instead." per_tenant_override_config: "Feature renamed to 'runtime configuration', flag deprecated in favor of runtime_config.file" per_tenant_override_period: "Feature renamed to 'runtime configuration', flag deprecated in favor of runtime_config.period" allow_deletes: "Use deletion_mode per tenant configuration instead." diff --git a/tools/deprecated-config-checker/test-fixtures/config.yaml b/tools/deprecated-config-checker/test-fixtures/config.yaml index eefe70c114ac8..5452de543b0e1 100644 --- a/tools/deprecated-config-checker/test-fixtures/config.yaml +++ b/tools/deprecated-config-checker/test-fixtures/config.yaml @@ -119,10 +119,6 @@ limits_config: unordered_writes: true # DEPRECATED ruler_evaluation_delay_duration: 1m # DEPRECATED ruler_remote_write_headers: ["foo", "bar"] # DEPRECATED - ruler_remote_write_relabel_configs: "foo" # DEPRECATED - ruler_remote_write_queue_capacity: 10 # DEPRECATED - ruler_remote_write_sigv4_config: # DEPRECATED - region: "wherever" per_tenant_override_config: ./overrides.yaml # DEPRECATED per_tenant_override_period: 5s # DEPRECATED allow_deletes: true # DEPRECATED diff --git a/tools/deprecated-config-checker/test-fixtures/runtime-config.yaml b/tools/deprecated-config-checker/test-fixtures/runtime-config.yaml index b699adc1a9aa2..865e35f4495c9 100644 --- a/tools/deprecated-config-checker/test-fixtures/runtime-config.yaml +++ b/tools/deprecated-config-checker/test-fixtures/runtime-config.yaml @@ -4,10 +4,6 @@ overrides: unordered_writes: true # DEPRECATED ruler_evaluation_delay_duration: 1m # DEPRECATED ruler_remote_write_headers: [ "foo", "bar" ] # DEPRECATED - ruler_remote_write_relabel_configs: "foo" # DEPRECATED - ruler_remote_write_queue_capacity: 10 # DEPRECATED - ruler_remote_write_sigv4_config: # DEPRECATED - region: "wherever" per_tenant_override_config: ./overrides.yaml # DEPRECATED per_tenant_override_period: 5s # DEPRECATED allow_deletes: true # DEPRECATED