-
Notifications
You must be signed in to change notification settings - Fork 10.3k
info() function returns empty when filtering by label that already exists on input vector #17813
Description
The experimental info() PromQL function returns no results when the info-selector filters by a label that already exists on the input vector, even when that label exists on target_info with a matching value.
Steps to Reproduce
Given OTLP metrics with resource attributes that result in:
Metric:
postgresql_commits_total{host_name="orbstack", instance="postgresql/postgres", job="postgresql"}
target_info:
target_info{host_name="orbstack", instance="postgresql/postgres", job="postgresql", service_name="postgresql", ...}
Note: host_name is promoted to the metric via promote_resource_attributes, so it exists on both the metric and target_info.
Queries and results:
Works - no filter
info(postgresql_commits_total)
✓ Returns enriched metrics
Works - filter by label only on target_info
info(postgresql_commits_total, {service_name="postgresql"})
✓ Returns enriched metrics
FAILS - filter by label that exists on BOTH metric and target_info
info(postgresql_commits_total, {host_name="orbstack"})
✗ Returns empty
info(postgresql_commits_total, {host_name=~".+"})
✗ Returns empty
Expected Behavior
All queries should return results. The info-selector filters which target_info series to consider. Since a matching target_info exists, the join should succeed regardless of whether the filter label also exists on the input metric.
Actual Behavior
When the info-selector includes a label that already exists on the input vector, info() returns no results.
Workaround
Filter on the metric directly, use info() selector only for labels exclusive to target_info:
info(postgresql_commits_total{host_name=~"$host_name"}, {service_name="postgresql"})