Skip to content

Commit 97de9f4

Browse files
committed
Revert "Use ingester prefix for LifecyclerConfig"
This reverts commit d6aa67a. Signed-off-by: Chris Marchbanks <[email protected]>
1 parent d6aa67a commit 97de9f4

File tree

6 files changed

+22
-70
lines changed

6 files changed

+22
-70
lines changed

pkg/ingester/ingester.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ type Config struct {
100100

101101
// RegisterFlags adds the flags required to config this to the given FlagSet
102102
func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
103-
cfg.LifecyclerConfig.RegisterFlagsWithPrefix("ingester.", f)
103+
cfg.LifecyclerConfig.RegisterFlags(f)
104104

105105
f.IntVar(&cfg.MaxTransferRetries, "ingester.max-transfer-retries", 10, "Number of times to try and transfer chunks before falling back to flushing.")
106106
f.DurationVar(&cfg.FlushCheckPeriod, "ingester.flush-period", 1*time.Minute, "Period with which to attempt to flush chunks.")

pkg/ring/consul_client.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
cleanhttp "github.com/hashicorp/go-cleanhttp"
1414

1515
"github.com/cortexproject/cortex/pkg/util"
16-
"github.com/cortexproject/cortex/pkg/util/flagext"
1716
"github.com/weaveworks/common/httpgrpc"
1817
"github.com/weaveworks/common/instrument"
1918
)
@@ -31,14 +30,14 @@ type ConsulConfig struct {
3130
ConsistentReads bool
3231
}
3332

34-
// RegisterFlags adds the flags required to config this to the given FlagSet.
33+
// RegisterFlags adds the flags required to config this to the given FlagSet
3534
// If prefix is not an empty string it should end with a period.
3635
func (cfg *ConsulConfig) RegisterFlags(f *flag.FlagSet, prefix string) {
37-
flagext.StringVarOnce(f, &cfg.Host, prefix+"consul.hostname", "localhost:8500", "Hostname and port of Consul.")
38-
flagext.StringVarOnce(f, &cfg.Prefix, prefix+"consul.prefix", "collectors/", "Prefix for keys in Consul. Should end with a /.")
39-
flagext.StringVarOnce(f, &cfg.ACLToken, prefix+"consul.acltoken", "", "ACL Token used to interact with Consul.")
40-
flagext.DurationVarOnce(f, &cfg.HTTPClientTimeout, prefix+"consul.client-timeout", 2*longPollDuration, "HTTP timeout when talking to consul")
41-
flagext.BoolVarOnce(f, &cfg.ConsistentReads, prefix+"consul.consistent-reads", true, "Enable consistent reads to consul.")
36+
f.StringVar(&cfg.Host, prefix+"consul.hostname", "localhost:8500", "Hostname and port of Consul.")
37+
f.StringVar(&cfg.Prefix, prefix+"consul.prefix", "collectors/", "Prefix for keys in Consul. Should end with a /.")
38+
f.StringVar(&cfg.ACLToken, prefix+"consul.acltoken", "", "ACL Token used to interact with Consul.")
39+
f.DurationVar(&cfg.HTTPClientTimeout, prefix+"consul.client-timeout", 2*longPollDuration, "HTTP timeout when talking to consul")
40+
f.BoolVar(&cfg.ConsistentReads, prefix+"consul.consistent-reads", true, "Enable consistent reads to consul.")
4241
}
4342

4443
type kv interface {

pkg/ring/kvstore.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"sync"
88

9-
"github.com/cortexproject/cortex/pkg/util/flagext"
109
"github.com/golang/protobuf/proto"
1110
"github.com/golang/snappy"
1211
)
@@ -48,7 +47,7 @@ func (cfg *KVConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
4847
if prefix == "" {
4948
prefix = "ring."
5049
}
51-
flagext.StringVarOnce(f, &cfg.Store, prefix+"store", "consul", "Backend storage to use for the ring (consul, inmemory).")
50+
f.StringVar(&cfg.Store, prefix+"store", "consul", "Backend storage to use for the ring (consul, inmemory).")
5251
}
5352

5453
// CASCallback is the type of the callback to CAS. If err is nil, out must be non-nil.

pkg/ring/lifecycler.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var (
4141
type LifecyclerConfig struct {
4242
RingConfig Config `yaml:"ring,omitempty"`
4343

44-
// Config for the ingester lifecycle control.
44+
// Config for the ingester lifecycle control
4545
ListenPort *int
4646
NumTokens int `yaml:"num_tokens,omitempty"`
4747
HeartbeatPeriod time.Duration `yaml:"heartbeat_period,omitempty"`
@@ -52,21 +52,21 @@ type LifecyclerConfig struct {
5252
InfNames []string `yaml:"interface_names"`
5353
FinalSleep time.Duration `yaml:"final_sleep"`
5454

55-
// For testing, you can override the address and ID of this ingester.
55+
// For testing, you can override the address and ID of this ingester
5656
Addr string `yaml:"address"`
5757
Port int
5858
ID string
5959
SkipUnregister bool
6060
}
6161

62-
// RegisterFlags adds the flags required to config this to the given FlagSet.
62+
// RegisterFlags adds the flags required to config this to the given FlagSet
6363
func (cfg *LifecyclerConfig) RegisterFlags(f *flag.FlagSet) {
6464
cfg.RegisterFlagsWithPrefix("", f)
6565
}
6666

67-
// RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet.
67+
// RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet
6868
func (cfg *LifecyclerConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
69-
cfg.RingConfig.RegisterFlags(f)
69+
cfg.RingConfig.RegisterFlagsWithPrefix(prefix, f)
7070

7171
f.IntVar(&cfg.NumTokens, prefix+"num-tokens", 128, "Number of tokens for each ingester.")
7272
f.DurationVar(&cfg.HeartbeatPeriod, prefix+"heartbeat-period", 5*time.Second, "Period at which to heartbeat to consul.")

pkg/ring/ring.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import (
1616
"github.com/prometheus/client_golang/prometheus"
1717

1818
"github.com/cortexproject/cortex/pkg/util"
19-
"github.com/cortexproject/cortex/pkg/util/flagext"
2019
)
2120

2221
const (
@@ -62,12 +61,17 @@ type Config struct {
6261
ReplicationFactor int `yaml:"replication_factor,omitempty"`
6362
}
6463

65-
// RegisterFlags adds the flags required to config this to the given FlagSet.
64+
// RegisterFlags adds the flags required to config this to the given FlagSet with a specified prefix
6665
func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
67-
cfg.KVStore.RegisterFlagsWithPrefix("", f)
66+
cfg.RegisterFlagsWithPrefix("", f)
67+
}
68+
69+
// RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet with a specified prefix
70+
func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) {
71+
cfg.KVStore.RegisterFlagsWithPrefix(prefix, f)
6872

69-
flagext.DurationVarOnce(f, &cfg.HeartbeatTimeout, "ring.heartbeat-timeout", time.Minute, "The heartbeat timeout after which ingesters are skipped for reads/writes.")
70-
flagext.IntVarOnce(f, &cfg.ReplicationFactor, "distributor.replication-factor", 3, "The number of ingesters to write to and read from.")
73+
f.DurationVar(&cfg.HeartbeatTimeout, prefix+"ring.heartbeat-timeout", time.Minute, "The heartbeat timeout after which ingesters are skipped for reads/writes.")
74+
f.IntVar(&cfg.ReplicationFactor, prefix+"distributor.replication-factor", 3, "The number of ingesters to write to and read from.")
7175
}
7276

7377
// Ring holds the information about the members of the consistent hash ring.

pkg/util/flagext/once.go

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)