From a90289a1935f1ccaa63a4c20e772b806fc493b27 Mon Sep 17 00:00:00 2001 From: Galen Kistler <109082771+gtk-grafana@users.noreply.github.com> Date: Wed, 19 Apr 2023 08:24:09 -0500 Subject: [PATCH] Prometheus: mark queries with instant results as invalid for incremental querying (#66846) mark queries with instant results as invalid for incremental querying --- .../app/plugins/datasource/prometheus/querycache/QueryCache.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/plugins/datasource/prometheus/querycache/QueryCache.ts b/public/app/plugins/datasource/prometheus/querycache/QueryCache.ts index 1551139fd8d..2ba7ca76c42 100644 --- a/public/app/plugins/datasource/prometheus/querycache/QueryCache.ts +++ b/public/app/plugins/datasource/prometheus/querycache/QueryCache.ts @@ -235,7 +235,7 @@ export class QueryCache { const newTo = request.range.to.valueOf(); // only cache 'now'-relative queries (that can benefit from a backfill cache) - const shouldCache = request.rangeRaw?.to?.toString() === 'now'; + const shouldCache = request.rangeRaw?.to?.toString() === 'now' && !request.targets.some((targ) => targ.instant); // all targets are queried together, so we check for any that causes group cache invalidation & full re-query let doPartialQuery = shouldCache;