Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more benchmarks for inhibition rules #3773

Conversation

grobinson-grafana
Copy link
Contributor

This commit adds more benchmarks for inhibition rules where just the last rule in the benchmark inhibits the labels. Here is an example of these benchmarks:

BenchmarkMutes/10_inhibition_rules,_last_rule_matches-8        	 1094041	      1020 ns/op
BenchmarkMutes/100_inhibition_rules,_last_rule_matches-8       	  347079	      3306 ns/op
BenchmarkMutes/1000_inhibition_rules,_last_rule_matches-8      	   39068	     26769 ns/op
BenchmarkMutes/10000_inhibition_rules,_last_rule_matches-8     	    4387	    260687 ns/op

This commit adds more benchmarks for inhibition rules where
just the last rule in the benchmark inhibits the labels.

Signed-off-by: George Robinson <george.robinson@grafana.com>
ih := NewInhibitor(s, rules, m, log.NewNopLogger())
defer ih.Stop()
go ih.Run()

// Wait some time for the inhibitor to seed its cache.
waitDuration := time.Millisecond * time.Duration(len(alerts))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't work when there was just 1 alert rule, 1ms was too short.

Signed-off-by: George Robinson <george.robinson@grafana.com>
Copy link
Member

@gotjosh gotjosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gotjosh gotjosh merged commit 14cbe63 into prometheus:main Mar 22, 2024
11 checks passed
th0th pushed a commit to th0th/alertmanager that referenced this pull request Mar 23, 2024
* Add more benchmarks for inhibition rules

This commit adds more benchmarks for inhibition rules where
just the last rule in the benchmark inhibits the labels.

Signed-off-by: George Robinson <george.robinson@grafana.com>

---------

Signed-off-by: George Robinson <george.robinson@grafana.com>
Signed-off-by: Gokhan Sari <gokhan@sari.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants