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 upTopological sorting of rules #17
Comments
ghost
assigned
juliusv
Jan 4, 2013
juliusv
referenced this issue
Mar 29, 2014
Closed
Metrics created by rules should keep the timestamp #386
bernerdschaefer
added a commit
that referenced
this issue
Apr 9, 2014
This comment has been minimized.
This comment has been minimized.
|
I suspect that this problem has corner cases that are unresolvable in the general case, such as when rules with the same name are applied to many variables, and thus that correctness can't be guaranteed. A mostly-working linter/sanity checker should be an achievable goal though. |
This comment has been minimized.
This comment has been minimized.
|
Yeah, you can create two rules with the same name, but you usually wouldn't encourage that, right? Maybe we should even forbid that? Or are there good use cases for this? I was btw. not thinking about a linter, but about Prometheus automatically sorting rules topologically according to their dependencies on other rules. |
This comment has been minimized.
This comment has been minimized.
I think it's an option to forbid it depending on what exact naming and rule conventions we decide on. There's also cases like rules that depend on themselves. |
This comment has been minimized.
This comment has been minimized.
stapelberg
commented
May 22, 2015
|
I think as a first step it’d be a good idea to evaluate rules in the order in which they were defined in the config file. |
This comment has been minimized.
This comment has been minimized.
|
Currently we are reading the files and their rules in order. On each evaluation iteration, we evaluate concurrently, though, because naive sequential evaluation can take longer than the evaluation interval. In that case iterations are missed. Side note: if the a single query in the concurrent evaluation takes longer, a whole iteration will be missed for all rules. We should not be waiting for all rules in an iteration to finish and only skip iterations for the slow queries. |
This comment has been minimized.
This comment has been minimized.
I've proposed that previously, some users are already at a point where that don't work for the reason @fabxc explains. The last time we talked about this the plan was to add syntax to let you define a groups of rules, which would be run in order. Different groups could run at the same time then. This could also be used to enable things like allowing rules to access remote storage (which you wouldn't want enabled by default). |
This comment has been minimized.
This comment has been minimized.
|
Mh, it seems like we can solve this internally. Not sure whether taking the issue to the user is the best approach here. Building a dependency graph will also be more optimal than one level of logical grouping by the user. |
This comment has been minimized.
This comment has been minimized.
This is only one aspect to the problem. What we also need to do is spread out the load of the rule evaluations and allow for cases when there's loops or things we can't determine about a dependency graph. I'm think ordered groups of rules with some micro-optimisation where it's safe is the route to take. |
This comment has been minimized.
This comment has been minimized.
|
I would think that cyclic dependencies error when reading the rules. Or are On Fri, May 22, 2015 at 12:48 PM Brian Brazil notifications@github.com
|
This comment has been minimized.
This comment has been minimized.
There are advanced use cases where it comes up. It's also possible that there's rules that aren't actually cyclic, but where it's not possible for us to determine that due to e.g. use of regexes. You also wouldn't want to couple rule evaluation between jobs, as that could lead to a problem in one job taking out evaluation in another. |
This comment has been minimized.
This comment has been minimized.
|
Can you elaborate on the "use of regexes" part. I know that there were plans to have |
This comment has been minimized.
This comment has been minimized.
|
@fabxc For example, if someone uses a regex matcher on the metric name in the rule expression, you can't analyze anymore whether the resulting metric name(s) would need some rule to be executed first. Same for other labels (you could have parts of one metric being selected in one rule, and other parts in another rule). |
This comment has been minimized.
This comment has been minimized.
|
Ah, those regexes – of course, thanks! |
brian-brazil
referenced this issue
Sep 16, 2015
Closed
Evaluation rules order of evaluation undefined #1088
juliusv
referenced this issue
Sep 17, 2015
Closed
Support grouping rules such that rules within a group are executed sequentially #1095
This comment has been minimized.
This comment has been minimized.
|
Superseded by #1095. |
juliusv
closed this
Sep 17, 2015
juliusv
added a commit
that referenced
this issue
Jul 18, 2016
simonpasquier
referenced
this issue
in simonpasquier/prometheus
Oct 12, 2017
bobmshannon
pushed a commit
to bobmshannon/prometheus
that referenced
this issue
Nov 19, 2018
simonpasquier
referenced
this issue
in simonpasquier/prometheus
Jan 31, 2019
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 24, 2019
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
juliusv commentedJan 4, 2013
Rules need to be evaluated in topological sort order in order to respect data dependencies between them.