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 upGeneral purpose rule/alert testing tool #1695
Comments
This comment has been minimized.
This comment has been minimized.
|
Yes, getting the discussion started would help a lot and make it easier for people willing to contribute to start working on something. So far this area has not progressed. For these kinds of things an RFC in a shared Google doc generally works best. |
This comment has been minimized.
This comment has been minimized.
|
Let me get the ball rolling with a few ideas here, a google doc can follow.
Perhaps you can put into a few more words what bothers you regarding the current time (range) stuff, and alternatives that might help? The current test syntax (to me) appears to be very simple, which is good: Concepts I think are missing:
Are there any query syntax changes proposed yet (in #1605 or elsewhere)? |
brian-brazil
added
the
kind/enhancement
label
Jun 9, 2016
This comment has been minimized.
This comment has been minimized.
|
Unfortunately we didn't follow up on the topic for a while even though we strongly want it. One main concern I have in hindsight is the DSL we currently use for testing PromQL. While it's brief and precise, it's yet another language we have to parse, and more importantly, specify ourselves. Especially as we want to have the following, partially overlapping, features:
I also don't see the DSL incorporate loading of arbitrary test/benchmarking sample data well, which won't be specifiable in 20 characters. |
This comment has been minimized.
This comment has been minimized.
We need rule file parsing and evaluation for that too, as there can be several layers of rules between data and alerts. |
gouthamve
referenced this issue
Mar 28, 2017
Closed
promql: separate expression language and rule parsing #1595
This comment has been minimized.
This comment has been minimized.
|
For alerts, this should also have the ability to test that the label and annotation templates expand to the expected values. |
This comment has been minimized.
This comment has been minimized.
|
@gouthamve That part is already mentioned/covered in #1220, although it could be additionally relevant here too. |
This comment has been minimized.
This comment has been minimized.
|
And also #1219. |
This comment has been minimized.
This comment has been minimized.
|
If we want to actually test not just whether the expression triggers but also whether it generates the right annotations and labels, we need to consider the full alert. Would be open to enforcing alertname uniqueness (I don't think many people use duplicates anyway) or does anyone have other ideas to address this? |
This comment has been minimized.
This comment has been minimized.
|
I think using the same alertname with different severity labels (expression with different thresholds) would be a common use case. |
This comment has been minimized.
This comment has been minimized.
|
Yes, duplicate alertnames with different labels is common. There could also be duplicates across rules from different teams. |
This comment has been minimized.
This comment has been minimized.
|
Forgot about warn/page level alerts with the same name – haven't written alerts in a while and it shows :) Anyway, so how would we tackle this then? Inline unit tests directly in rules files or rely on users to keep their alerts and their copies in unit tests in sync? |
This comment has been minimized.
This comment has been minimized.
|
I would have it that unit tests can pull in the rule files/groups that are relevant. |
This comment has been minimized.
This comment has been minimized.
|
Yea sure, but how is this supposed to happen if there's no unique identifier to reference a rule by? |
This comment has been minimized.
This comment has been minimized.
|
This is why I've been saying that rule groups should usually be named. |
This comment has been minimized.
This comment has been minimized.
|
Or just specify a (list of) rule files to load in whole, a list of series and their samples as input (similarly to how we load in data for testing expressions), and the entirety of expected received alerts / notifications as output. That still allows you to test only one alert per test if you want (simply reference the same rule files from multiple test cases, but with different expected inputs / outputs). It also handles the case nicely where an alerting rule depends on other recording rules, etc. |
This comment has been minimized.
This comment has been minimized.
|
Mh, that might actually work – makes it easy to define cases triggering warn and severe at once too. Would still constrain that to |
stephen-soltesz
referenced this issue
May 19, 2017
Merged
Add framework to implement tests on queries for prometheus alerts #30
brian-brazil
added
component/promtool
priority/P2
labels
Jul 14, 2017
This comment has been minimized.
This comment has been minimized.
aweiteka
commented
Dec 5, 2017
|
I have a high interest in rules testing. I've tried m-lab/prometheus-support#30 and like the general pattern. I'll be at KubeCon 2017 in Austin this week if folks want to discuss. |
This comment has been minimized.
This comment has been minimized.
|
Sure, we would love to discuss this. Please catch us at any of the events:
https://prometheus.io/blog/2017/11/30/prometheus-at-cloudnativecon/
Or hop onto IRC (#prometheus on freenode) to say Hi!
…On Tue, Dec 5, 2017 at 10:00 AM Aaron Weitekamp ***@***.***> wrote:
I have a high interest in rules testing. I've tried
m-lab/prometheus-support#30
<m-lab/prometheus-support#30> and like the
general pattern.
I'll be at KubeCon 2017 in Austin this week if folks want to discuss.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1695 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHA3HxRVPbuvKYKUKIP2nj8HucsNSzCsks5s9WiEgaJpZM4Iq39t>
.
|
gouthamve
added
the
not-as-easy-as-it-looks
label
Jan 18, 2018
This comment has been minimized.
This comment has been minimized.
|
Is anyone working on this issue? I would be interested in pushing it further with some help. |
This comment has been minimized.
This comment has been minimized.
|
Noone is working on this that I'm aware of. |
This comment has been minimized.
This comment has been minimized.
|
/cc @codesome who wants to put this in his GSoC proposal |
This comment has been minimized.
This comment has been minimized.
|
Yes, I plan to add this in my GSoC proposal |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
kevinjqiu
commented
Jun 18, 2018
|
Ahh didn't know it's a feature being actively worked on. At my work, we came up with this https://github.com/kevinjqiu/pat and hopefully this can be of some use to someone. |
This comment has been minimized.
This comment has been minimized.
DeathBorn
commented
Jul 4, 2018
|
for some reson this |
This comment has been minimized.
This comment has been minimized.
kevinjqiu
commented
Jul 4, 2018
|
@DeathBorn Could you open an issue @ https://github.com/kevinjqiu/pat/issues ? |
This comment has been minimized.
This comment has been minimized.
|
Got added in #4350. |
brian-brazil
closed this
Sep 25, 2018
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. |
tamsky commentedMay 31, 2016
•
edited
https://groups.google.com/d/msg/prometheus-developers/h6Vp2pf619A/AJsKJsJTHQAJ
DL;DR (very edited) summary:
I would like to help get the specification ball rolling here.
@fabxc Has there been any work done to spec this out since that post?