Skip to content

promql: fix info function returning empty when filtering by overlapping labels#17817

Merged
aknuds1 merged 1 commit intoprometheus:mainfrom
aknuds1:arve/fix-17813
Jan 9, 2026
Merged

promql: fix info function returning empty when filtering by overlapping labels#17817
aknuds1 merged 1 commit intoprometheus:mainfrom
aknuds1:arve/fix-17813

Conversation

@aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented Jan 8, 2026

When filtering by a label that exists on both the input metric and target_info (e.g., info(metric, {host_name="orbstack"}) where host_name exists on both), the function incorrectly returned empty results.

The bug was in combineWithInfoVector: when no new labels were added (because they all overlapped with base metric labels), the code entered the "no match" filtering block even though an info series WAS matched.

The fix adds a check for len(seenInfoMetrics) == 0 to correctly distinguish between:

  1. No info series matched at all - potentially filter out
  2. Info series matched but labels overlapped - keep the series

Which issue(s) does the PR fix:

Fixes #17813

Does this PR introduce a user-facing change?

[BUGFIX] PromQL: Fix PromQL info() function returning empty results when filtering by a label that exists on both the input metric and `target_info`

@aknuds1 aknuds1 requested a review from roidelapluie as a code owner January 8, 2026 14:11
@aknuds1 aknuds1 force-pushed the arve/fix-17813 branch 2 times, most recently from 3fd50fd to 65d0906 Compare January 8, 2026 14:19
When filtering by a label that exists on both the input metric and
target_info (e.g., info(metric, {host_name="orbstack"}) where host_name
exists on both), the function incorrectly returned empty results.

The bug was in combineWithInfoVector: when no new labels were added
(because they all overlapped with base metric labels), the code entered
the "no match" filtering block even though an info series WAS matched.

The fix checks len(seenInfoMetrics) == 0 to correctly identify when no
info series matched. If an info series matched (seenInfoMetrics is
non-empty), the series is kept even if no new labels were added.

Fixes prometheus#17813

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
Copy link
Member

@jesusvazquez jesusvazquez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@aknuds1 aknuds1 merged commit 1670376 into prometheus:main Jan 9, 2026
28 checks passed
@aknuds1 aknuds1 deleted the arve/fix-17813 branch January 9, 2026 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

info() function returns empty when filtering by label that already exists on input vector

3 participants