Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove deprecated ruler_remote_write_relabel_configs, ruler_remote_wr…
Browse files Browse the repository at this point in the history
…ite_queue_capacity and ruler_remote_write_sigv4_config
shantanualsi committed Nov 8, 2023
1 parent 0e9ee70 commit 4acbe72
Showing 10 changed files with 3 additions and 134 deletions.
23 changes: 0 additions & 23 deletions docs/sources/configure/_index.md
Original file line number Diff line number Diff line change
@@ -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: <headers>]

# Deprecated: Use 'ruler_remote_write_config' instead. List of remote write
# relabel configurations.
[ruler_remote_write_relabel_configs: <relabel_config...>]

# 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: <int>]

# 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: <string> | default = ""]

[access_key: <string> | default = ""]

[secret_key: <string> | default = ""]

[profile: <string> | default = ""]

[role_arn: <string> | default = ""]

# Configures global and per-tenant limits for remote write clients. A map with
# remote client id as key.
[ruler_remote_write_config: <map of string to RemoteWriteConfig>]
1 change: 0 additions & 1 deletion docs/sources/operations/overrides-exporter.md
Original file line number Diff line number Diff line change
@@ -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
```

5 changes: 0 additions & 5 deletions pkg/ruler/compat.go
Original file line number Diff line number Diff line change
@@ -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
58 changes: 3 additions & 55 deletions pkg/ruler/registry.go
Original file line number Diff line number Diff line change
@@ -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{}
25 changes: 0 additions & 25 deletions pkg/validation/limits.go
Original file line number Diff line number Diff line change
@@ -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 {
5 changes: 0 additions & 5 deletions pkg/validation/limits_test.go
Original file line number Diff line number Diff line change
@@ -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",
9 changes: 0 additions & 9 deletions tools/deprecated-config-checker/checker/checker_test.go
Original file line number Diff line number Diff line change
@@ -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",
3 changes: 0 additions & 3 deletions tools/deprecated-config-checker/deprecated-config.yaml
Original file line number Diff line number Diff line change
@@ -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."
4 changes: 0 additions & 4 deletions tools/deprecated-config-checker/test-fixtures/config.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4acbe72

Please sign in to comment.