1
0
mirror of https://github.com/prometheus/prometheus synced 2025-03-23 11:46:41 +00:00
prometheus/promql
György Krajcsovits 2f144dd3ad feat(promql): offset from static time expression
Related to  .

Allow using a PromQL expression for setting the offset, provided that:

the expression evaluates to a scalar
the expression does not contain vector selector (no TSDB access)
the expression does not call the info() function (no TSDB access)
the time() function is only called on the top level of the expression,
  not inside a subquery

We'll call such expression a time expression.

During parsing we no longer set OriginalOffset field in sub-queries and
vector selectors, instead we set a new OriginalOffsetExpr field to the
time expression, even if the expression is a literal number.

Before evaluating the overall PromQL expression, the engine shall
evaluate the time expressions and set the OriginalOffset field in vector
selectors and subqueries to the calculated value. This makes the change
fairly non intrusive. Later we can change the code to start using the
expression more directly. Note: this prohibits using time() function
inside a sub-query as the evaluation time is not constant inside a
sub-query.

Signed-off-by: György Krajcsovits <gyorgy.krajcsovits@grafana.com>
2025-02-03 13:08:35 +01:00
..
fuzz-data
parser feat(promql): offset from static time expression 2025-02-03 13:08:35 +01:00
promqltest feat(promql): offset from static time expression 2025-02-03 13:08:35 +01:00
bench_test.go v2.55.0 2024-10-25 14:16:22 +02:00
engine_internal_test.go chore!: adopt log/slog, remove go-kit/log 2024-10-07 15:58:50 -04:00
engine_test.go feat(promql): offset from static time expression 2025-02-03 13:08:35 +01:00
engine.go feat(promql): offset from static time expression 2025-02-03 13:08:35 +01:00
functions_internal_test.go Fix issue where summation of +/- infinity returns NaN instead of infinity 2024-06-28 11:26:54 +10:00
functions_test.go Refactor engine creation in tests 2024-07-14 13:58:51 +02:00
functions.go [FEATURE] PromQL: Implements idelta and irate with histograms () 2025-01-31 23:11:03 +01:00
fuzz_test.go fix: use "ErrorContains" or "EqualError" instead of "Contains(t, err.Error()" and "Equal(t, err.Error()" () 2024-10-06 16:35:29 +00:00
fuzz.go scrape: provide a fallback format () 2024-10-18 17:12:31 +02:00
histogram_stats_iterator_test.go Upgrade to golangci-lint v1.62.0 () 2024-11-20 17:22:20 +01:00
histogram_stats_iterator.go Use CopyTo when resetting histogram in stats iterator 2024-07-31 11:18:47 +02:00
info_test.go [FEATURE] PromQL: Add experimental info function MVP () 2024-10-16 13:52:11 +01:00
info.go enable errorf rule from perfsprint linter 2024-11-06 16:50:36 +01:00
promql_test.go Refactor engine creation in tests 2024-07-14 13:58:51 +02:00
quantile_test.go Export quantile functions () 2024-11-27 13:20:23 +01:00
quantile.go Ensure metric name is present on histogram_quantile annotations () 2025-01-22 14:35:43 +01:00
query_logger_test.go chore: Fix typos () 2024-09-10 22:32:03 +02:00
query_logger.go chore!: adopt log/slog, remove go-kit/log 2024-10-07 15:58:50 -04:00
value_test.go test: move most PromQL tests into separate test package 2024-05-08 16:28:56 +01:00
value.go chore: Fix typos () 2024-09-10 22:32:03 +02:00