What this PR does / why we need it:
* Add a new per-tenant query timeout
* Adds new middleware to query calls. This new middleware will timeout requests based on the new per-tenant query timeout
* Add span logs to query calls missing it
* Deprecate `engine.timeout` configuration
The motivation to change this configuration to be per-tenant instead of global is that it makes sense to alleviate the timeout for particular tenants or make it more strict for others. Especially useful for scenarios where the Loki client doesn't handle context cancellations correctly; in such scenarios, since Loki would still process expensive queries that were canceled, this allows one to have small timeouts for most tenants, which will help mitigate unnecessary work without having a timeout that is too short for important tenants.
* [6358](https://github.com/grafana/loki/pull/6358) **taharah**: Fixes sigv4 authentication for the Ruler's remote write configuration by allowing both a global and per tenant configuration.
* [6375](https://github.com/grafana/loki/pull/6375) **dannykopping**: Fix bug that prevented users from using the `json` parser after a `line_format` pipeline stage.
##### Changes
* [6726](https://github.com/grafana/loki/pull/6726) **kavirajk** upgrades go from 1.17.9 -> 1.18.4
* [6415](https://github.com/grafana/loki/pull/6415) **salvacorts** Evenly spread queriers across kubernetes nodes.
* [6726](https://github.com/grafana/loki/pull/6726) **kavirajk**: upgrades go from 1.17.9 -> 1.18.4
* [6415](https://github.com/grafana/loki/pull/6415) **salvacorts**: Evenly spread queriers across kubernetes nodes.
* [6349](https://github.com/grafana/loki/pull/6349) **simonswine**: Update the default HTTP listen port from 80 to 3100. Make sure to configure the port explicitly if you are using port 80.
* [6835](https://github.com/grafana/loki/pull/6835) **DylanGuedes**: Add new per-tenant query timeout configuration and remove engine query timeout.
@ -33,6 +33,12 @@ The output is incredibly verbose as it shows the entire internal config struct u
### Loki
### Engine query timeout is deprecated
Previously, we had two configurations to define a query timeout: `engine.timeout` and `querier.query-timeout`.
As they were conflicting and `engine.timeout` isn't as expressive as `querier.query-tiomeout`,
we're deprecating it in favor of relying on `engine.query-timeout` only.
#### Fifocache is deprecated
We introduced a new cache called `embedded-cache` which is an in-process cache system that make it possible to run Loki without the need for an external cache (like Memcached, Redis, etc). It can be run in two modes `distributed: false` (default, and same as old `fifocache`) and `distributed: true` which runs cache in distributed fashion sharding keys across peers if Loki is run in microservices or SSD mode.
f.DurationVar(&opts.Timeout,prefix+".engine.timeout",5*time.Minute,"Timeout for query execution.")
// TODO: remove this configuration after next release.
f.DurationVar(&opts.Timeout,prefix+".engine.timeout",5*time.Minute,"Timeout for query execution. Instead, rely only on querier.query-timeout. (deprecated)")
f.DurationVar(&opts.MaxLookBackPeriod,prefix+".engine.max-lookback-period",30*time.Second,"The maximum amount of time to look back for log lines. Used only for instant log queries.")
f.DurationVar(&cfg.TailMaxDuration,"querier.tail-max-duration",1*time.Hour,"Limit the duration for which live tailing request would be served")
f.DurationVar(&cfg.QueryTimeout,"querier.query-timeout",1*time.Minute,"Timeout when querying backends (ingesters or storage) during the execution of a query request")
f.DurationVar(&cfg.ExtraQueryDelay,"querier.extra-query-delay",0,"Time to wait before sending more than the minimum successful query requests.")
f.DurationVar(&cfg.QueryIngestersWithin,"querier.query-ingesters-within",3*time.Hour,"Maximum lookback beyond which queries are not sent to ingester. 0 means all queries are sent to ingester.")
f.IntVar(&cfg.MaxConcurrent,"querier.max-concurrent",10,"The maximum number of concurrent queries.")
f.Var(&l.MaxQueryLength,"store.max-query-length","Limit to length of chunk store queries, 0 to disable.")
f.IntVar(&l.MaxQuerySeries,"querier.max-query-series",500,"Limit the maximum of unique series returned by a metric query. When the limit is reached an error is returned.")
_=l.QueryTimeout.Set("1m")
f.Var(&l.QueryTimeout,"querier.query-timeout","Timeout when querying backends (ingesters or storage) during the execution of a query request. If a specific per-tenant timeout is used, this timeout is ignored.")
_=l.MaxQueryLookback.Set("0s")
f.Var(&l.MaxQueryLookback,"querier.max-query-lookback","Limit how long back data (series and metadata) can be queried, up until <lookback> duration ago. This limit is enforced in the query-frontend, querier and ruler. If the requested time range is outside the allowed range, the request will not fail but will be manipulated to only query data within the allowed time range. 0 to disable.")
@ -443,6 +446,10 @@ func (o *Overrides) MaxEntriesLimitPerQuery(userID string) int {