|
|
|
|
@ -17,6 +17,7 @@ const ( |
|
|
|
|
DefaultBucketSize = 1 * time.Minute |
|
|
|
|
DefaultEvictInterval = 30 * time.Minute |
|
|
|
|
DefaultNumPartitions = 64 |
|
|
|
|
DefaultConsumerGroup = "ingest-limits" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// Config represents the configuration for the ingest limits service.
|
|
|
|
|
@ -49,6 +50,8 @@ type Config struct { |
|
|
|
|
// LifecyclerConfig is the config to build a ring lifecycler.
|
|
|
|
|
LifecyclerConfig ring.LifecyclerConfig `yaml:"lifecycler,omitempty"` |
|
|
|
|
KafkaConfig kafka.Config `yaml:"-"` |
|
|
|
|
ConsumerGroup string `yaml:"consumer_group"` |
|
|
|
|
Topic string `yaml:"topic"` |
|
|
|
|
|
|
|
|
|
// Deprecated.
|
|
|
|
|
WindowSize time.Duration `yaml:"window_size" doc:"hidden|deprecated"` |
|
|
|
|
@ -93,6 +96,18 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet) { |
|
|
|
|
DefaultNumPartitions, |
|
|
|
|
"The number of partitions for the Kafka topic used to read and write stream metadata. It is fixed, not a maximum.", |
|
|
|
|
) |
|
|
|
|
f.StringVar( |
|
|
|
|
&cfg.ConsumerGroup, |
|
|
|
|
"ingest-limits.consumer-group", |
|
|
|
|
DefaultConsumerGroup, |
|
|
|
|
"The consumer group for the Kafka topic used to read stream metadata records.", |
|
|
|
|
) |
|
|
|
|
f.StringVar( |
|
|
|
|
&cfg.Topic, |
|
|
|
|
"ingest-limits.topic", |
|
|
|
|
"", |
|
|
|
|
"The topic for the Kafka topic used to read and write stream metadata records.", |
|
|
|
|
) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (cfg *Config) Validate() error { |
|
|
|
|
@ -114,5 +129,11 @@ func (cfg *Config) Validate() error { |
|
|
|
|
if cfg.NumPartitions <= 0 { |
|
|
|
|
return errors.New("num-partitions must be greater than 0") |
|
|
|
|
} |
|
|
|
|
if cfg.ConsumerGroup == "" { |
|
|
|
|
return errors.New("consumer-group must be set") |
|
|
|
|
} |
|
|
|
|
if cfg.Topic == "" { |
|
|
|
|
return errors.New("topic must be set") |
|
|
|
|
} |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
|
|