Prom Error: multiple matches for labels: grouping labels must ensure unique matches #2365
cgrinds
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Query
Prometheus sometimes returns the following error for the above query.
multiple matches for labels: grouping labels must ensure unique matchesThis happens because of how
group_leftworks.vector_a group_left(label-list) vector_b.group_leftmeans the left side is the many-side and the right side is the one-side. The one side must return a unique set of values for the labels in label-list.In the example above, the one-side is
volume_labelswhich means that vector expression must return unique values foraggr. If they don't, Prometheus will return themultiple matches for labels: grouping labels must ensure unique matcheserror.Examples
Using the following metrics/labels as an example, let's take a look at some queries that succeed and fail.
avg_over_time(volume_read_latency{volume="dummy"}[2d])
0
0.012811504590593971
avg_over_time(volume_read_latency{volume="dummy"}[10d])
0
0
0.005758743393763292
volume_labels{volume="dummy"}
1
This query succeeds
avg_over_time(volume_read_latency{volume="dummy"}[2d]) * on(cluster, svm, volume) group_left(aggr) volume_labels{cluster="umeng-aff300-01-02"}
0
0.012827728530556734
This query fails
avg_over_time(volume_read_latency{volume="dummy"}[10d]) * on(cluster, svm, volume) group_left(aggr) volume_labels{cluster="umeng-aff300-01-02"}
Error executing query: multiple matches for labels: grouping labels must ensure unique matchesThis query fails because the resulting vector is ambiguous. It's ambiguous because
group_left(aggr)copies the aggr value from the right side into the resulting vector, which creates a label collision in the result. In other words, when the left and right vectors are combined withgroup_left(aggr), the resulting vector would no longer be unique since the first two metrics are now identical:This query succeeds
avg_over_time(volume_read_latency{volume="dummy"}[10d]) * on(cluster, svm, volume) group_left volume_labels{cluster="umeng-aff300-01-02"}
0
0
0.005758743393763292
Reference
Beta Was this translation helpful? Give feedback.
All reactions