cortexproject / cortex

A horizontally scalable, highly available, multi-tenant, long term Prometheus.

Home Page:https://cortexmetrics.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Query Frontend: queries with negative offset should check whether it is cacheable or not

yeya24 opened this issue · comments

Describe the bug
We enabled negative offset feature by default in Cortex. However, negative offset might query data in the future timestamp and those latest data response shouldn't be cached. We missed such check in Query Frontend similar to what we have for @ modifier https://github.com/cortexproject/cortex/blob/master/pkg/querier/tripperware/queryrange/results_cache.go#L313.

Expected behavior
If a query has negative offset, I expect we won't cache its results if the promql query time range after applying negative offset is later than max cache freshness time.

We can also start simple by not caching queries with negative offset.

Hi! I would like to work on this issue, I think I understand what changes to make, will make a PR soon.

We can also start simple by not caching queries with negative offset.

I would recommend we start simple with this option.