Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated ruler configs in limits.go #11105

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* [10727](https://github.com/grafana/loki/pull/10727) **sandeepsukhani** Native otlp ingestion support
* [11051](https://github.com/grafana/loki/pull/11051) Refactor to not use global logger in modules
* [10956](https://github.com/grafana/loki/pull/10956) **jeschkies** do not wrap requests but send pure Protobuf from frontend v2 via scheduler to querier when `-frontend.encoding=protobuf`.
* [11105](https://github.com/grafana/loki/pull/11105) **shantanualsi** Remove deprecated `ruler_remote_write_*` configs from `limit_config` in favour of `remote_write_config`

##### Fixes
* [11074](https://github.com/grafana/loki/pull/11074) **hainenber** Fix panic in lambda-promtail due to mishandling of empty DROP_LABELS env var.
Expand Down
64 changes: 0 additions & 64 deletions docs/sources/configure/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2793,70 +2793,6 @@ The `limits_config` block configures global and per-tenant limits in Loki.
# Disable recording rules remote-write.
[ruler_remote_write_disabled: <boolean>]

# Deprecated: Use 'ruler_remote_write_config' instead. The URL of the endpoint
# to send samples to.
[ruler_remote_write_url: <string> | default = ""]

# Deprecated: Use 'ruler_remote_write_config' instead. Timeout for requests to
# the remote write endpoint.
[ruler_remote_write_timeout: <duration>]

# Deprecated: 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.
[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. Minimum number of shards,
# i.e. amount of concurrency.
[ruler_remote_write_queue_min_shards: <int>]

# Deprecated: Use 'ruler_remote_write_config' instead. Maximum number of shards,
# i.e. amount of concurrency.
[ruler_remote_write_queue_max_shards: <int>]

# Deprecated: Use 'ruler_remote_write_config' instead. Maximum number of samples
# per send.
[ruler_remote_write_queue_max_samples_per_send: <int>]

# Deprecated: Use 'ruler_remote_write_config' instead. Maximum time a sample
# will wait in buffer.
[ruler_remote_write_queue_batch_send_deadline: <duration>]

# Deprecated: Use 'ruler_remote_write_config' instead. Initial retry delay. Gets
# doubled for every retry.
[ruler_remote_write_queue_min_backoff: <duration>]

# Deprecated: Use 'ruler_remote_write_config' instead. Maximum retry delay.
[ruler_remote_write_queue_max_backoff: <duration>]

# Deprecated: Use 'ruler_remote_write_config' instead. Retry upon receiving a
# 429 status code from the remote-write storage. This is experimental and might
# change in the future.
[ruler_remote_write_queue_retry_on_ratelimit: <boolean>]

# 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>]
Expand Down
8 changes: 0 additions & 8 deletions docs/sources/operations/overrides-exporter.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +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_batch_send_deadline"} 0
loki_overrides_defaults{limit_name="ruler_remote_write_queue_capacity"} 0
loki_overrides_defaults{limit_name="ruler_remote_write_queue_max_backoff"} 0
loki_overrides_defaults{limit_name="ruler_remote_write_queue_max_samples_per_send"} 0
loki_overrides_defaults{limit_name="ruler_remote_write_queue_max_shards"} 0
loki_overrides_defaults{limit_name="ruler_remote_write_queue_min_backoff"} 0
loki_overrides_defaults{limit_name="ruler_remote_write_queue_min_shards"} 0
loki_overrides_defaults{limit_name="ruler_remote_write_timeout"} 0
loki_overrides_defaults{limit_name="split_queries_by_interval"} 0
```

Expand Down
15 changes: 0 additions & 15 deletions pkg/ruler/compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -37,20 +35,7 @@ type RulesLimits interface {
ruler.RulesLimits

RulerRemoteWriteDisabled(userID string) bool
RulerRemoteWriteURL(userID string) string
RulerRemoteWriteTimeout(userID string) time.Duration
RulerRemoteWriteHeaders(userID string) map[string]string
RulerRemoteWriteRelabelConfigs(userID string) []*util.RelabelConfig
RulerRemoteWriteConfig(userID string, id string) *config.RemoteWriteConfig
RulerRemoteWriteQueueCapacity(userID string) int
RulerRemoteWriteQueueMinShards(userID string) int
RulerRemoteWriteQueueMaxShards(userID string) int
RulerRemoteWriteQueueMaxSamplesPerSend(userID string) int
RulerRemoteWriteQueueBatchSendDeadline(userID string) time.Duration
RulerRemoteWriteQueueMinBackoff(userID string) time.Duration
RulerRemoteWriteQueueMaxBackoff(userID string) time.Duration
RulerRemoteWriteQueueRetryOnRateLimit(userID string) bool
RulerRemoteWriteSigV4Config(userID string) *sigv4.SigV4Config

RulerRemoteEvaluationTimeout(userID string) time.Duration
RulerRemoteEvaluationMaxResponseSize(userID string) int64
Expand Down
99 changes: 0 additions & 99 deletions pkg/ruler/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ruler
import (
"context"
"fmt"
"net/url"
"strings"
"time"

Expand All @@ -13,16 +12,12 @@ import (
"github.com/imdario/mergo"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
promConfig "github.com/prometheus/common/config"
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/model/exemplar"
"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"
Expand Down Expand Up @@ -239,71 +234,6 @@ func (r *walRegistry) getTenantRemoteWriteConfig(tenant string, base RemoteWrite
// metadata is only used by prometheus scrape configs
clt.MetadataConfig = config.MetadataConfig{Send: false}

// Keeping these blocks for backward compatibility
if v := r.overrides.RulerRemoteWriteURL(tenant); v != "" {
u, err := url.Parse(v)
if err != nil {
return nil, fmt.Errorf("error parsing given remote-write URL: %w", err)
}
clt.URL = &promConfig.URL{u}
}
if v := r.overrides.RulerRemoteWriteTimeout(tenant); v > 0 {
clt.RemoteTimeout = model.Duration(v)
}

// overwrite, do not merge
if v := r.overrides.RulerRemoteWriteHeaders(tenant); v != nil {
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.RulerRemoteWriteQueueMinShards(tenant); v > 0 {
clt.QueueConfig.MinShards = v
}

if v := r.overrides.RulerRemoteWriteQueueMaxShards(tenant); v > 0 {
clt.QueueConfig.MaxShards = v
}

if v := r.overrides.RulerRemoteWriteQueueMaxSamplesPerSend(tenant); v > 0 {
clt.QueueConfig.MaxSamplesPerSend = v
}

if v := r.overrides.RulerRemoteWriteQueueMinBackoff(tenant); v > 0 {
clt.QueueConfig.MinBackoff = model.Duration(v)
}

if v := r.overrides.RulerRemoteWriteQueueMaxBackoff(tenant); v > 0 {
clt.QueueConfig.MaxBackoff = model.Duration(v)
}

if v := r.overrides.RulerRemoteWriteQueueBatchSendDeadline(tenant); v > 0 {
clt.QueueConfig.BatchSendDeadline = model.Duration(v)
}

if v := r.overrides.RulerRemoteWriteQueueRetryOnRateLimit(tenant); v {
clt.QueueConfig.RetryOnRateLimit = 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 {
Expand All @@ -329,35 +259,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{}
Expand Down
Loading
Loading