promql: fix panic with @ modifier on empty ranges#18020
Merged
bwplotka merged 1 commit intoprometheus:mainfrom Feb 6, 2026
Merged
promql: fix panic with @ modifier on empty ranges#18020bwplotka merged 1 commit intoprometheus:mainfrom
bwplotka merged 1 commit intoprometheus:mainfrom
Conversation
When using the @ modifier with a timestamp that has no data, several PromQL range functions were panicking with "index out of range [0] with length 0". This was introduced by prometheus#16797 which changed function signatures to use concrete types instead of interfaces. The panic occurred because functions were accessing array elements (matrixVal[0], vectorVals[0][0]) without checking if the arrays were empty first. Fixes prometheus#18018 Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
yeya24
approved these changes
Feb 5, 2026
Contributor
yeya24
left a comment
There was a problem hiding this comment.
Thanks for the prompt fix!
wbollock
pushed a commit
to wbollock/prometheus
that referenced
this pull request
Feb 6, 2026
When using the @ modifier with a timestamp that has no data, several PromQL range functions were panicking with "index out of range [0] with length 0". This was introduced by prometheus#16797 which changed function signatures to use concrete types instead of interfaces. The panic occurred because functions were accessing array elements (matrixVal[0], vectorVals[0][0]) without checking if the arrays were empty first. Fixes prometheus#18018 Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com> Signed-off-by: Will Bollock <wbollock@linode.com>
wbollock
pushed a commit
to wbollock/prometheus
that referenced
this pull request
Feb 6, 2026
When using the @ modifier with a timestamp that has no data, several PromQL range functions were panicking with "index out of range [0] with length 0". This was introduced by prometheus#16797 which changed function signatures to use concrete types instead of interfaces. The panic occurred because functions were accessing array elements (matrixVal[0], vectorVals[0][0]) without checking if the arrays were empty first. Fixes prometheus#18018 Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
wbollock
pushed a commit
to wbollock/prometheus
that referenced
this pull request
Feb 6, 2026
When using the @ modifier with a timestamp that has no data, several PromQL range functions were panicking with "index out of range [0] with length 0". This was introduced by prometheus#16797 which changed function signatures to use concrete types instead of interfaces. The panic occurred because functions were accessing array elements (matrixVal[0], vectorVals[0][0]) without checking if the arrays were empty first. Fixes prometheus#18018 Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
wbollock
pushed a commit
to wbollock/prometheus
that referenced
this pull request
Feb 6, 2026
When using the @ modifier with a timestamp that has no data, several PromQL range functions were panicking with "index out of range [0] with length 0". This was introduced by prometheus#16797 which changed function signatures to use concrete types instead of interfaces. The panic occurred because functions were accessing array elements (matrixVal[0], vectorVals[0][0]) without checking if the arrays were empty first. Fixes prometheus#18018 Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
wbollock
pushed a commit
to wbollock/prometheus
that referenced
this pull request
Feb 6, 2026
When using the @ modifier with a timestamp that has no data, several PromQL range functions were panicking with "index out of range [0] with length 0". This was introduced by prometheus#16797 which changed function signatures to use concrete types instead of interfaces. The panic occurred because functions were accessing array elements (matrixVal[0], vectorVals[0][0]) without checking if the arrays were empty first. Fixes prometheus#18018 Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
wbollock
pushed a commit
to wbollock/prometheus
that referenced
this pull request
Feb 6, 2026
When using the @ modifier with a timestamp that has no data, several PromQL range functions were panicking with "index out of range [0] with length 0". This was introduced by prometheus#16797 which changed function signatures to use concrete types instead of interfaces. The panic occurred because functions were accessing array elements (matrixVal[0], vectorVals[0][0]) without checking if the arrays were empty first. Fixes prometheus#18018 Signed-off-by: Julien Pivotto <291750+roidelapluie@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using the @ modifier with a timestamp that has no data, several PromQL range functions were panicking with "index out of range [0] with length 0". This was introduced by #16797 which changed function signatures to use concrete types instead of interfaces.
The panic occurred because functions were accessing array elements (matrixVal[0], vectorVals[0][0]) without checking if the arrays were empty first.
Fixes #18018
Which issue(s) does the PR fix:
Does this PR introduce a user-facing change?