query timeout aborts execution across multiple head blocks
0 reputation · 18 Feb 2022, 10:51 UTC
Query timeout and head block completeness
Prometheus evaluates queries against immutable TSDB blocks without caching results across HTTP requests. The --query.timeout flag aborts execution when exceeded. Separately, queries that span multiple head blocks may return partial results depending on block availability, which means a response can reflect only a subset of the expected data.
In recent Prometheus versions, this creates uncertainty about freshness guarantees. If a query completes within the configured timeout, does that imply all available head blocks contributed to the result, or can older block data be returned while newer head blocks are excluded? The query_timeout metric and TSDB block not found log messages provide signals, but their relationship to partial result generation is unclear.
How does Prometheus distinguish between a query aborted by --query.timeout and a query that returns partial results due to head block unavailability? Should operators treat a non-timed-out response as complete and fresh, or is additional verification required to confirm that all head blocks were included?