* cleans up internal limits struct, removes unnecessary logic
* moves querier.split-queries-by-interval to limits, simplifies resulting code.
* docs, changelog
* flag supports model.duration instead of time.duration
* lint and adds new error for deprecated field
* reregisters queryrange flags
* comment lint
* ensures we validate queryrange config and simplifies embedded struct validate()
* 0 still disables
* simplify cache key generation and protect against divide by zero
* [5243](https://github.com/grafana/loki/pull/5243) **owen-d**: moves `querier.split-queries-by-interval` to limits code only.
* [5139](https://github.com/grafana/loki/pull/5139) **DylanGuedes**: Drop support for legacy configuration rules format.
* [4911](https://github.com/grafana/loki/pull/4911) **jeschkies**: Support Docker service discovery in Promtail.
* [5107](https://github.com/grafana/loki/pull/5107) **chaudum** Fix bug in fluentd plugin that caused log lines containing non UTF-8 characters to be dropped.
// RegisterFlags adds the flags required to config this to the given FlagSet.
func(cfg*Config)RegisterFlags(f*flag.FlagSet){
f.IntVar(&cfg.MaxRetries,"querier.max-retries-per-request",5,"Maximum number of retries for a single request; beyond this, the downstream error is returned.")
f.DurationVar(&cfg.SplitQueriesByInterval,"querier.split-queries-by-interval",0,"Split queries by an interval and execute in parallel, 0 disables it. You should use an a multiple of 24 hours (same as the storage bucketing scheme), to avoid queriers downloading and processing the same chunks. This also determines how cache keys are chosen when result caching is enabled")
f.BoolVar(&cfg.AlignQueriesWithStep,"querier.align-querier-with-step",false,"Mutate incoming queries to align their start and end with their step.")
f.BoolVar(&cfg.ShardedQueries,"querier.parallelise-shardable-queries",false,"Perform query parallelisations based on storage sharding configuration and query ASTs. This feature is supported only by the chunks storage engine.")
f.BoolVar(&cfg.ShardedQueries,"querier.parallelise-shardable-queries",true,"Perform query parallelisations based on storage sharding configuration and query ASTs. This feature is supported only by the chunks storage engine.")
f.Var(&cfg.ForwardHeaders,"frontend.forward-headers-list","List of headers forwarded by the query Frontend to downstream querier.")
cfg.ResultsCacheConfig.RegisterFlags(f)
}
// Validate validates the config.
func(cfg*Config)Validate()error{
ifcfg.SplitQueriesByInterval!=0{
returnerrors.New("the yaml flag `split_queries_by_interval` must now be set in the `limits_config` section instead of the `query_range` config section")
f.Var(&l.PerTenantOverridePeriod,"limits.per-user-override-period","Period with this to reload the overrides.")
_=l.QuerySplitDuration.Set("30m")
f.Var(&l.QuerySplitDuration,"querier.split-queries-by-interval","Split queries by an interval and execute in parallel, 0 disables it. This also determines how cache keys are chosen when result caching is enabled")
}
// UnmarshalYAML implements the yaml.Unmarshaler interface.