Description
Is your feature request related to a problem? Please describe.
Today, Cortex uses query and query range API handlers from upstream Prometheus. This is great because of less code to maintain. However, it also limits the extensibility of these 2 APIs today in Cortex.
Take Thanos as an example, it extends query and query range API with additional parameters such as query analyze, downsample resolution, partial response, engine switch etc. Without a dedicated API handler, it is hard to do the same extensions.
Describe the solution you'd like
Create API handlers for query and query_range similar to the existing Prometheus API handlers.
Query Range: https://github.com/prometheus/prometheus/blob/main/web/api/v1/api.go#L544
Query: https://github.com/prometheus/prometheus/blob/main/web/api/v1/api.go#L443
The con of having our own handlers is that it might take more efforts to be in sync with upstream implementations. But given the stability of these 2 APIs, it is probably ok to maintain our own.