mirror of https://github.com/grafana/loki
feat(api)!: Fail log queries when executed on instant query endpoint (#13421)
### What this PR does / why we need it
**Background**
A log selector expression is a LogQL expression that returns logs, in contrast to a sample expressions, which returns metrics (samples). The simplest form of log selector expressions are label matchers, e.g. `{env="prod"}`.
**Change**
This PR changes the behaviour of Loki so that the instant query endpoint `/api/v1/query` does not allow sending a log selector expression as query any more. Instead, it returns a status code 400 (Bad Request) with the error message **"log queries are not supported as an instant query type, please change you query to a range query type"**.
**Why**
Previously this API endpoint allowed these types of log queries, but returned inconsistent results, which where a major cause for confusion. Returning a concise error helps the user understand that they likely selected the wrong query type in Grafana when executing the query.
---
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
pull/13433/head
parent
cf5f52dca0
commit
ce71f1cf95
Loading…
Reference in new issue