feat(demo): generate long list of alerts to test lazy load / pagination

This commit is contained in:
Łukasz Mierzwa
2019-08-31 15:49:23 +01:00
parent 847577c938
commit 57cb613c30
2 changed files with 22 additions and 0 deletions
+6
View File
@@ -12,6 +12,11 @@ route:
match_re:
alertname: .*
continue: true
- receiver: "pagination"
group_by: ["alertname", "instance"]
match_re:
alertname: Pagination Test
continue: false
- receiver: "by-cluster-service"
group_by: ["alertname", "cluster", "service"]
match_re:
@@ -38,6 +43,7 @@ inhibit_rules:
receivers:
- name: "default"
- name: "pagination"
- name: "by-cluster-service"
- name: "by-name"
- name: "by-cluster"
+16
View File
@@ -398,6 +398,21 @@ class SilencedAlertWithJiraLink(AlertGenerator):
]
class PaginationTest(AlertGenerator):
name = "Pagination Test"
comment = "Huge number of alerts to test pagination & lazy load"
def alerts(self):
return [
newAlert(
self._labels(instance="server{}".format(i), cluster="dev",
severity="warning", job="node_exporter",
region="US"),
self._annotations(dashboard="https://example.com")
) for i in xrange(0, 1000)
]
if __name__ == "__main__":
generators = [
AlwaysOnAlert(MAX_INTERVAL),
@@ -412,6 +427,7 @@ if __name__ == "__main__":
InhibitedAlert(MAX_INTERVAL),
InhibitingAlert(MAX_INTERVAL),
SilencedAlertWithJiraLink(MAX_INTERVAL),
PaginationTest(MAX_INTERVAL),
]
while True:
for g in generators: