Skip to content

Commit a635a1e

Browse files
author
Tyler Reid
authored
Update cortex to use runtime config from dskit (#4440)
* Update cortex to use runtime config from dskit Signed-off-by: Tyler Reid <[email protected]> * Add cortex prefix to generic metrics from dskit Signed-off-by: Tyler Reid <[email protected]>
1 parent 70dddb6 commit a635a1e

File tree

6 files changed

+21
-297
lines changed

6 files changed

+21
-297
lines changed

pkg/cortex/cortex.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/go-kit/kit/log"
1414
"github.com/go-kit/kit/log/level"
1515
"github.com/grafana/dskit/modules"
16+
"github.com/grafana/dskit/runtimeconfig"
1617
"github.com/grafana/dskit/services"
1718
"github.com/pkg/errors"
1819
"github.com/prometheus/client_golang/prometheus"
@@ -60,7 +61,6 @@ import (
6061
"github.com/cortexproject/cortex/pkg/util/grpc/healthcheck"
6162
util_log "github.com/cortexproject/cortex/pkg/util/log"
6263
"github.com/cortexproject/cortex/pkg/util/process"
63-
"github.com/cortexproject/cortex/pkg/util/runtimeconfig"
6464
"github.com/cortexproject/cortex/pkg/util/validation"
6565
)
6666

@@ -120,7 +120,7 @@ type Config struct {
120120
Configs configs.Config `yaml:"configs"`
121121
Alertmanager alertmanager.MultitenantAlertmanagerConfig `yaml:"alertmanager"`
122122
AlertmanagerStorage alertstore.Config `yaml:"alertmanager_storage"`
123-
RuntimeConfig runtimeconfig.ManagerConfig `yaml:"runtime_config"`
123+
RuntimeConfig runtimeconfig.Config `yaml:"runtime_config"`
124124
MemberlistKV memberlist.KVConfig `yaml:"memberlist"`
125125
QueryScheduler scheduler.Config `yaml:"query_scheduler"`
126126
}

pkg/cortex/modules.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
"github.com/go-kit/kit/log/level"
1212
"github.com/grafana/dskit/modules"
13+
"github.com/grafana/dskit/runtimeconfig"
1314
"github.com/grafana/dskit/services"
1415
"github.com/opentracing-contrib/go-stdlib/nethttp"
1516
"github.com/opentracing/opentracing-go"
@@ -32,7 +33,7 @@ import (
3233
"github.com/cortexproject/cortex/pkg/configs/db"
3334
"github.com/cortexproject/cortex/pkg/distributor"
3435
"github.com/cortexproject/cortex/pkg/flusher"
35-
frontend "github.com/cortexproject/cortex/pkg/frontend"
36+
"github.com/cortexproject/cortex/pkg/frontend"
3637
"github.com/cortexproject/cortex/pkg/frontend/transport"
3738
"github.com/cortexproject/cortex/pkg/ingester"
3839
"github.com/cortexproject/cortex/pkg/querier"
@@ -46,7 +47,6 @@ import (
4647
"github.com/cortexproject/cortex/pkg/scheduler"
4748
"github.com/cortexproject/cortex/pkg/storegateway"
4849
util_log "github.com/cortexproject/cortex/pkg/util/log"
49-
"github.com/cortexproject/cortex/pkg/util/runtimeconfig"
5050
"github.com/cortexproject/cortex/pkg/util/validation"
5151
)
5252

@@ -157,7 +157,7 @@ func (t *Cortex) initRuntimeConfig() (services.Service, error) {
157157
// make sure to set default limits before we start loading configuration into memory
158158
validation.SetDefaultLimitsForYAMLUnmarshalling(t.Cfg.LimitsConfig)
159159

160-
serv, err := runtimeconfig.NewRuntimeConfigManager(t.Cfg.RuntimeConfig, prometheus.DefaultRegisterer)
160+
serv, err := runtimeconfig.New(t.Cfg.RuntimeConfig, prometheus.WrapRegistererWithPrefix("cortex_", prometheus.DefaultRegisterer), util_log.Logger)
161161
if err == nil {
162162
// TenantLimits just delegates to RuntimeConfig and doesn't have any state or need to do
163163
// anything in the start/stopping phase. Thus we can create it as part of runtime config

pkg/cortex/runtime_config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import (
55
"io"
66
"net/http"
77

8+
"github.com/grafana/dskit/runtimeconfig"
89
"gopkg.in/yaml.v2"
910

1011
"github.com/cortexproject/cortex/pkg/ingester"
1112
"github.com/cortexproject/cortex/pkg/ring/kv"
1213
"github.com/cortexproject/cortex/pkg/util"
13-
"github.com/cortexproject/cortex/pkg/util/runtimeconfig"
1414
"github.com/cortexproject/cortex/pkg/util/validation"
1515
)
1616

pkg/util/runtimeconfig/manager_test.go

-279
This file was deleted.

0 commit comments

Comments
 (0)