PromQL: Add fill*() binop modifiers to provide default values for missing series#17644
PromQL: Add fill*() binop modifiers to provide default values for missing series#17644
fill*() binop modifiers to provide default values for missing series#17644Conversation
4560728 to
2831d40
Compare
2831d40 to
a1b8c38
Compare
a1b8c38 to
f03a45a
Compare
fill*() binop modifiers to provide default values for missing seriesfill*() binop modifiers to provide default values for missing series
|
I added tests and documentation for the modifiers now and removed the For the closure that I introduced in the binop computation, it seems fine, or at least it doesn't seem to change the Before: After: A remaining issue is the interplay of delayed metric name removal ( |
|
CC @jcreixell as the author of the delayed metric name removal feature, would you be able to advise on the following?
There's never really a collision at each individual time step - only when merging different time steps together. |
|
I believe Jorge is on paternity leave for a few months, so may not reply. |
|
@juliusv do you have a unit test highlighting the issue so we can better help? |
|
@roidelapluie Yes, I've noticed now that the problem is actually more general and does not require the new fill modifiers to be provoked. The problem is in general that we:
So you can also provoke it like this: Or if you want to provoke it with the new fill modifiers, you could do: There's also more ways to provoke this, like: All these queries run fine without delayed metric name removal, but cause collision errors when delayed metric name removal is enabled. I mentioned the same example queries in #15855 already as well. So I think this is generally an issue that can and should be fixed separately from the new fill modifiers. I guess you'd either have to:
|
See #17644 (comment) Signed-off-by: Julius Volz <julius.volz@gmail.com>
See #17644 (comment) Signed-off-by: Julius Volz <julius.volz@gmail.com>
See #17644 (comment) Signed-off-by: Julius Volz <julius.volz@gmail.com>
|
Btw. I built a tenative fix for merging colliding series after delayed metric name removal in this branch: https://github.com/prometheus/prometheus/commits/delayed-name-removal-series-merge/ - maybe I can still simplify it though, so not opening a PR yet. In general, I'm wondering whether we should keep delayed metric name removal at all. It just makes everything more confusing and less clean IMO. But that's again not really related to the fill modifiers :) |
|
WDYT of #17678 ? |
|
Hi, as @bboreham mentioned, I am on parental leave until February and nowhere near a laptop to look into this in depth right now. I wanted to keep @beorn7 in the loop as he is really the brain behind this feature (I mostly followed his advice while implementing it). In terms of whether to keep the feature or not, I can see that this has come up a few times, and I think it's a philosophical question on whether every processing step should be self contained and independent (which helps tooling like promlens, and might be more elegant and intuitive, particularly for devs) or whether we should defer some processing to the last step for efficiency reasons and to resolve some otherwise surprising (to the less experience user) query errors due to implementation details of the query engine. I don't have a definitive answer and don't know much about the specifics on how multiple steps are merged together during query processing (intuitively, it sounds like having duplicated labels for a single step at the end of processing should indeed cause an error, but i need to look into this in more detail to fully understand it). I just wanted to say that I am not married to this feature and I fully trust the team to make the right call on this, so please don't be blocked by me and do not hesitate to remove it if it doesn't make sense or creates too many problems. And thank you @juliusv and @roidelapluie looking into this and proposing solutions 🙏 |
Thanks for chiming in, and I hope you are enjoying your parental leave :)
Good to know! And yep, my opinion is also not super strong on this, but I do feel it has some complexity and understandability drawbacks at least that people should consider when deciding to keep it or not. But it's probably better discussed on the issues related to delayed metric name removal in due time. |
…issing series Signed-off-by: Julius Volz <julius.volz@gmail.com>
Signed-off-by: Julius Volz <julius.volz@gmail.com>
Signed-off-by: Julius Volz <julius.volz@gmail.com>
Signed-off-by: Julius Volz <julius.volz@gmail.com>
Signed-off-by: Julius Volz <julius.volz@gmail.com>
f0d2ad4 to
d6aa6a3
Compare
|
Did a basic search, did not find anything, perhaps I has missed something - my question is: |
|
@linasm I wanted to bring up that question today as well. While I am tempted to just merge it without a flag immediately, I think putting it behind an feature flag might actually be the safer and more responsible way to go. So far it feels like only a small handful of people have taken a look at the details, and it's probably best to not set things 100% in stone yet. You probably would agree? |
In general, it is better to be safe than sorry, but I don't have a strong opinion on this one. More interested in what the maintainers would say. |
Signed-off-by: Julius Volz <julius.volz@gmail.com>
|
Alright, I added a new commit that puts the new modifiers behind a new |
|
nit: Why not reusing https://prometheus.io/docs/prometheus/latest/feature_flags/#experimental-promql-functions |
|
Chatted on Slack, it is modifier, so fine for another flag. I wanted to try to reduce the ff surface, but it's a bit of an abuse to reuse. |
bwplotka
left a comment
There was a problem hiding this comment.
Looks good to me.
The only nit is around test case for the metric names like `"fill + fill" that hits the special case we added.
Signed-off-by: Julius Volz <julius.volz@gmail.com>
Signed-off-by: Julius Volz <julius.volz@gmail.com>
|
Will merge for now to get it in before more merge conflicts, since it's already approved and I only made the minimal requested changes. Happy to make follow-up changes of course, if desired. |
This starts implementing the proposal for default value binop modifiers throughout the stack, from the PromQL parser+engine all the way to the UI and PromLens visualizer.
So you can now do something like:
Or:
A few special considerations to note:
on(),group_left(), etc. are reserved words that are NOT allowed as metric names. I did not want to break existing users, so I could not adopt the same behavior for the new fill modifiers. For example, a user might have an expression likefoo + fill, where both are metric names, and that still needs to be parseable as a metric name. Thus I had to extend the lexer to only emit fill modifier tokens if there is a parenthesis following them. Maybe there's a better way of doing this directly in the grammar, but I think yacc works makes that hard? Input / experimentation by others welcome.Other than those notes, progress is roughly:
fill,fill_left, andfill_rightmodifiers to the PromQL lexer + parser.Here's a screenshot of how it looks in the PromLens tree view and the matching visualization in the "Explain" tab:
Fixes #13625
Does this PR introduce a user-facing change?