Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upVector/vector filter comparisons return match group labels rather than LHS labels #5326
Comments
juliusv
added
help wanted
low hanging fruit
kind/bug
component/promql
labels
Mar 10, 2019
This comment has been minimized.
This comment has been minimized.
|
Btw., when including |
This comment has been minimized.
This comment has been minimized.
|
To generalize, when including an |
This comment has been minimized.
This comment has been minimized.
|
sounds like a breaking change. |
This comment has been minimized.
This comment has been minimized.
|
Yeah, that'd be breaking. I'd need to think on this one. |
This comment has been minimized.
This comment has been minimized.
|
|
brian-brazil
changed the title
Filter operators drop metric name when using on() modifier
Vector/vector filter comparisons return match group labels rather than LHS labels
Mar 10, 2019
This comment has been minimized.
This comment has been minimized.
|
So we've had bug fixes in the past that technically changed behavior, but since they were bug fixes they were deemed ok most of the time. Probably it depends on how much we expect people to rely on this behavior already and how breaking the change would likely be for those people. On the other hand if we don't fix it, we need to document that it's broken. |
This comment has been minimized.
This comment has been minimized.
|
Okay, we've no unittests covering this. The documented behaviour is what makes sense consistency wise, so the question is how breaking is this. |
This comment has been minimized.
This comment has been minimized.
|
For the time being, users who are affected by this can get the desired behavior by adding group_left() |
This comment has been minimized.
This comment has been minimized.
|
True, we could define this to be the correct behaviour and leave that as a workaround. |
This comment has been minimized.
This comment has been minimized.
|
I'd prefer calling it a bug and fixing it, but also not sure where the boundary for that should be. Officially defining PromQL to be this weirdly inconsistent would trigger me at least :) |
This comment has been minimized.
This comment has been minimized.
|
I would propose to first see if that is a regression or an all time bug. |
This comment has been minimized.
This comment has been minimized.
|
If it's a regression, it's from one of the rewrites: either mine last year, or the one Fabian did a few years back. I'd suspect it's always been like this. |
This comment has been minimized.
This comment has been minimized.
|
I tried prometheus-2.0.0-beta.1 and the bug was there |
roidelapluie
added a commit
to roidelapluie/prometheus
that referenced
this issue
Mar 10, 2019
This comment has been minimized.
This comment has been minimized.
|
Thinking on it, if anyone is depending on this behaviour they can always wrap a sum() around the LHS as we know there's only one series on the LHS per group. Otherwise it'd be causing a many-to-one errror. |
This comment has been minimized.
This comment has been minimized.
|
@brian-brazil Does that mean we should fix it or keep it as it is? |
juliusv
referenced this issue
Apr 3, 2019
Open
promql: Support non-existent column names in keep() #1118
This comment has been minimized.
This comment has been minimized.
|
I think we should fix it. |
juliusv commentedMar 10, 2019
See http://demo.robustperception.io:9090/graph?g0.range_input=1h&g0.expr=node_cpu_seconds_total%20%3D%3D%20on(cpu%2C%20instance%2C%20job%2C%20mode)%20node_cpu_seconds_total&g0.tab=1&g1.range_input=1h&g1.expr=node_cpu_seconds_total%20%3D%3D%20node_cpu_seconds_total&g1.tab=1
When adding an
on()modifier to a vector-to-vector filter, the metric name is dropped. Without the modifier, the metric name is retained. According to the docs at https://prometheus.io/docs/prometheus/latest/querying/operators/#comparison-binary-operators, the metric name should always be kept for filter operators (when not using theboolmodifier).