Skip to content

Commit

Permalink
Update cortex to use runtime config from dskit (cortexproject#4440)
Browse files Browse the repository at this point in the history
* Update cortex to use runtime config from dskit

Signed-off-by: Tyler Reid <tyler.reid@grafana.com>

* Add cortex prefix to generic metrics from dskit

Signed-off-by: Tyler Reid <tyler.reid@grafana.com>
  • Loading branch information
Tyler Reid authored Aug 26, 2021
1 parent 70dddb6 commit a635a1e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 297 deletions.
4 changes: 2 additions & 2 deletions pkg/cortex/cortex.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/grafana/dskit/modules"
"github.com/grafana/dskit/runtimeconfig"
"github.com/grafana/dskit/services"
"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -60,7 +61,6 @@ import (
"github.com/cortexproject/cortex/pkg/util/grpc/healthcheck"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/cortexproject/cortex/pkg/util/process"
"github.com/cortexproject/cortex/pkg/util/runtimeconfig"
"github.com/cortexproject/cortex/pkg/util/validation"
)

Expand Down Expand Up @@ -120,7 +120,7 @@ type Config struct {
Configs configs.Config `yaml:"configs"`
Alertmanager alertmanager.MultitenantAlertmanagerConfig `yaml:"alertmanager"`
AlertmanagerStorage alertstore.Config `yaml:"alertmanager_storage"`
RuntimeConfig runtimeconfig.ManagerConfig `yaml:"runtime_config"`
RuntimeConfig runtimeconfig.Config `yaml:"runtime_config"`
MemberlistKV memberlist.KVConfig `yaml:"memberlist"`
QueryScheduler scheduler.Config `yaml:"query_scheduler"`
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/cortex/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/go-kit/kit/log/level"
"github.com/grafana/dskit/modules"
"github.com/grafana/dskit/runtimeconfig"
"github.com/grafana/dskit/services"
"github.com/opentracing-contrib/go-stdlib/nethttp"
"github.com/opentracing/opentracing-go"
Expand All @@ -32,7 +33,7 @@ import (
"github.com/cortexproject/cortex/pkg/configs/db"
"github.com/cortexproject/cortex/pkg/distributor"
"github.com/cortexproject/cortex/pkg/flusher"
frontend "github.com/cortexproject/cortex/pkg/frontend"
"github.com/cortexproject/cortex/pkg/frontend"
"github.com/cortexproject/cortex/pkg/frontend/transport"
"github.com/cortexproject/cortex/pkg/ingester"
"github.com/cortexproject/cortex/pkg/querier"
Expand All @@ -46,7 +47,6 @@ import (
"github.com/cortexproject/cortex/pkg/scheduler"
"github.com/cortexproject/cortex/pkg/storegateway"
util_log "github.com/cortexproject/cortex/pkg/util/log"
"github.com/cortexproject/cortex/pkg/util/runtimeconfig"
"github.com/cortexproject/cortex/pkg/util/validation"
)

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

serv, err := runtimeconfig.NewRuntimeConfigManager(t.Cfg.RuntimeConfig, prometheus.DefaultRegisterer)
serv, err := runtimeconfig.New(t.Cfg.RuntimeConfig, prometheus.WrapRegistererWithPrefix("cortex_", prometheus.DefaultRegisterer), util_log.Logger)
if err == nil {
// TenantLimits just delegates to RuntimeConfig and doesn't have any state or need to do
// anything in the start/stopping phase. Thus we can create it as part of runtime config
Expand Down
2 changes: 1 addition & 1 deletion pkg/cortex/runtime_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"io"
"net/http"

"github.com/grafana/dskit/runtimeconfig"
"gopkg.in/yaml.v2"

"github.com/cortexproject/cortex/pkg/ingester"
"github.com/cortexproject/cortex/pkg/ring/kv"
"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/runtimeconfig"
"github.com/cortexproject/cortex/pkg/util/validation"
)

Expand Down
279 changes: 0 additions & 279 deletions pkg/util/runtimeconfig/manager_test.go

This file was deleted.

Loading

0 comments on commit a635a1e

Please sign in to comment.