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 upScrape-time rule evaluation #394
Comments
This comment has been minimized.
This comment has been minimized.
camerondavison
commented
Apr 28, 2015
|
Are you talking about something like http://prometheus.io/docs/querying/rules/ recording rules? |
This comment has been minimized.
This comment has been minimized.
|
Yes, but evaluated in the context of a target at scrape time rather than at recording rule evaluation time. |
brian-brazil
added
the
feature-request
label
Dec 16, 2015
fabxc
added
kind/enhancement
and removed
feature request
labels
Apr 28, 2016
This comment has been minimized.
This comment has been minimized.
nomis52
commented
Jul 1, 2016
|
Yes please! I'm new to Prometheus having used a very similar system for the last decade. The ability to do standing rule evaluation was a core piece of the real time monitoring story. |
brian-brazil
referenced this issue
Aug 31, 2016
Closed
Fix race between federation and ingestion #1920
brian-brazil
added
priority/Pmaybe
component/rules
labels
Jul 14, 2017
This comment has been minimized.
This comment has been minimized.
|
While I think we'll need this at some point, there's no clamour for this yet so Pmaybe. |
This comment has been minimized.
This comment has been minimized.
|
When implementing this it would be great to have those recording rules also able to look at the past. E.g. to calculate urates/rates. |
This comment has been minimized.
This comment has been minimized.
|
irates |
This comment has been minimized.
This comment has been minimized.
|
Extra note: do we want this before of after relabelling? I'd say we want this after relabelling so that we can compare with relabelled metrics from previous scrapes. |
This comment has been minimized.
This comment has been minimized.
|
It has to be after metric relabelling, doesn't make sense otherwise. |
This comment has been minimized.
This comment has been minimized.
|
can we move this one step further and agree on a design?
The problem in my proposal is that "expr" becomes go-templated. |
This comment has been minimized.
This comment has been minimized.
It would be of the scrape. Why would you want a less accurate timestamp?
We should be trying to run after each scrape. The question is more how does this interact with the scrape timeout.
It would, just like recording rules do. |
This comment has been minimized.
This comment has been minimized.
That would be very difficult for a user to use. The PromQL would be tweaked in the background. This prevents anyone using honor_labels/metric_relabel_configs to take in samples that don't match the target labels - but that's I think a fundamental issue here. Such a rule can only access data from its target. |
This comment has been minimized.
This comment has been minimized.
|
honor_labels/metric_relabel_configs must be out of scope because with them you can get metrics that have no common labels. Or are we ready to limit the scope of the rules to exactly the series of the job/target (and then forbid the usage of, e.g. stddev)? |
This comment has been minimized.
This comment has been minimized.
Scrape-time rules are per-target, so if you want to do stddev across targets you still need a recording rule. Stddev within a target would still work. |
This comment has been minimized.
This comment has been minimized.
|
That makes writing rules simpler. But how is the data about which timeserie belong to which target recorded, and persisted across restart? I guess we have that for staleness already. |
This comment has been minimized.
This comment has been minimized.
|
It isn't, the promql would be adjusted to have matchers for all the target labels added to it. Something you haven't considered: How do you tell a scrape time rule which targets it applies to? |
This comment has been minimized.
This comment has been minimized.
|
We set the " job: snmp" at the group level, which implies it will run after each scrape of a target in that job |
This comment has been minimized.
This comment has been minimized.
That is then ignoring relabeling/honor_labels ? |
This comment has been minimized.
This comment has been minimized.
Why is the job label special here, or do you mean the scrape config name?
It's more that the labels of the scraped data may not match the target labels. |
This comment has been minimized.
This comment has been minimized.
Yes scrape config name, so job_name would be better.
So what would be the solution here? |
This comment has been minimized.
This comment has been minimized.
That could be an entire k8 cluster, of which you only want to apply the rule to one service. I think this should work off target labels.
I don't think there is one, it'd just be a known limitation. |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
|
Without a limitation also on job_name, there would be a penalty on every scrape |
This comment has been minimized.
This comment has been minimized.
|
Not really, targets aren't created often. Templating should also not be in the expr. |
This comment has been minimized.
This comment has been minimized.
|
Okay so, we would scan the targets when they are created/changed/deleted and also when rules are created/changed/deleted. |
This comment has been minimized.
This comment has been minimized.
|
Proposed design, after this discussion:
|
This comment has been minimized.
This comment has been minimized.
This is inventing a new way to do label matching, which is already a bit icky for the alertmanager which is similar. How about using selectors?
Rules must be evaluated after every scrape, rules can produce results when a scrape fails. This is the same as recording rules.
I don't see why this is required. |
This comment has been minimized.
This comment has been minimized.
|
so ..
The reasoning about having at least one metric is to be sure that the scope of the recording rule can be limited. But indeed you are right it should not be mandatory. One other question: Do we want to add the target labels to the resulting metrics? |
This comment has been minimized.
This comment has been minimized.
|
Yes, otherwise we couldn't ensure that that the labels were present. |
brian-brazil commentedJun 9, 2014
I'm currently working with the /proc/meminfo stats, and one of the missing stats is "Memory Used" so you have to calculate it. Doing so via rules isn't a good idea due to time skew, so it'd be handy if you could specify some rules to be run at scrape time against the data for a given instance.