qontract-reconcile 0.10.1rc403__py3-none-any.whl → 0.10.1rc404__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: qontract-reconcile
3
- Version: 0.10.1rc403
3
+ Version: 0.10.1rc404
4
4
  Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
5
5
  Home-page: https://github.com/app-sre/qontract-reconcile
6
6
  Author: Red Hat App-SRE Team
@@ -612,7 +612,7 @@ tools/app_interface_reporter.py,sha256=8HUH8kkW50-plKgiTgCiFINJNN_cl4ZFzmY4aSnRa
612
612
  tools/glitchtip_access_reporter.py,sha256=oPBnk_YoDuljU3v0FaChzOwwnk4vap1xEE67QEjzdqs,2948
613
613
  tools/glitchtip_access_revalidation.py,sha256=8kbBJk04mkq28kWoRDDkfCGIF3GRg3pJrFAh1sW0dbk,2821
614
614
  tools/qontract_cli.py,sha256=xEMgcF90wD9gak8JbYemKog0alh_usFhwwvyB356Ukw,97319
615
- tools/sd_app_sre_alert_report.py,sha256=utFZCreITuTZTiOaFNCaVPyFK0zxFZbc_ElcngGbiW8,4346
615
+ tools/sd_app_sre_alert_report.py,sha256=e9vAdyenUz2f5c8-z-5WY0wv-SJ9aePKDH2r4IwB6pc,5063
616
616
  tools/cli_commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
617
617
  tools/cli_commands/gpg_encrypt.py,sha256=JryinrDdvztN931enUY3FuDeLVnfs6y58mnK7itNK6Y,4940
618
618
  tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
@@ -620,10 +620,10 @@ tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y
620
620
  tools/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
621
621
  tools/test/test_app_interface_metrics_exporter.py,sha256=dmEcNwZltP1rd_4DbxIYakOCh0DHp8Trox3Z1N0Au3U,1293
622
622
  tools/test/test_qontract_cli.py,sha256=awwTHEc2DWlykuqGIYM0WOBoSL0KRnOraCLk3C7izis,1401
623
- tools/test/test_sd_app_sre_alert_report.py,sha256=JeLhgzpKCPgLvptwg_4ZvJHLVWKNG1T5845HXTkMBxA,1826
623
+ tools/test/test_sd_app_sre_alert_report.py,sha256=v363r9zM7__0kR5K6mvJoGFcM9BvE33fWAayrqkpojA,2116
624
624
  tools/test/test_sre_checkpoints.py,sha256=SKqPPTl9ua0RFdSSofnoQX-JZE6dFLO3LRhfQzqtfh8,2607
625
- qontract_reconcile-0.10.1rc403.dist-info/METADATA,sha256=cIo20x-baQGEabysu8S0LhYBh9G8h8NeNGF0KOyJhlU,2347
626
- qontract_reconcile-0.10.1rc403.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
627
- qontract_reconcile-0.10.1rc403.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
628
- qontract_reconcile-0.10.1rc403.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
629
- qontract_reconcile-0.10.1rc403.dist-info/RECORD,,
625
+ qontract_reconcile-0.10.1rc404.dist-info/METADATA,sha256=b9GKyDFeTPk7MF_yySTu-dEW0mwHiA7I_PF_yBkWy3Y,2347
626
+ qontract_reconcile-0.10.1rc404.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
627
+ qontract_reconcile-0.10.1rc404.dist-info/entry_points.txt,sha256=rTjAv28I_CHLM8ID3OPqMI_suoQ9s7tFbim4aYjn9kk,376
628
+ qontract_reconcile-0.10.1rc404.dist-info/top_level.txt,sha256=l5ISPoXzt0SdR4jVdkfa7RPSKNc8zAHYWAnR-Dw8Ey8,24
629
+ qontract_reconcile-0.10.1rc404.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: bdist_wheel (0.41.3)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -82,6 +82,21 @@ def group_alerts(messages: list[dict]) -> dict[str, list[Alert]]:
82
82
  )
83
83
  )
84
84
  else:
85
+ # This may happen for alerts rules without "message". This can happen
86
+ # if schema cannot be validated for a certain alert rule because it
87
+ # is not valid yaml (go templates, jinja templates)
88
+ if "text" not in at:
89
+ alert_state = "FIRING" if "FIRING" in mg.group(2) else mg.group(2)
90
+ alerts[alert_name].append(
91
+ Alert(
92
+ state=alert_state,
93
+ message="placeholder",
94
+ timestamp=timestamp,
95
+ username=m["username"],
96
+ )
97
+ )
98
+ continue
99
+
85
100
  alert_state = ""
86
101
  for line in at["text"].split("\n"):
87
102
  if "Alerts Firing" in line:
@@ -28,16 +28,21 @@ def test_group_alerts():
28
28
  assert csopc
29
29
  assert len(csopc) == 1
30
30
 
31
+ art = alerts["AlertmanagerReceiverTest"]
32
+ assert art
33
+ assert len(art) == 2
34
+
31
35
  # This means one of the list elements has been ignored as it didn't have alertname
32
- # as the total alerts we have from the above tests is 11 and the total of messages
33
- # from the fixture is 12.
36
+ # as the total alerts we have from the above tests is 13 and the total of messages
37
+ # from the fixture is 14.
34
38
  assert set(alerts.keys()) == {
35
39
  "PrometheusTargetFlapping",
36
40
  "SLOMetricAbsent",
37
41
  "PatchmanAlertEvalDelay",
38
42
  "ContainerSecurityOperatorPodCount",
43
+ "AlertmanagerReceiverTest",
39
44
  }
40
- assert len(messages) == 12
45
+ assert len(messages) == 14
41
46
 
42
47
 
43
48
  def test_alert_stats():
@@ -62,3 +67,8 @@ def test_alert_stats():
62
67
  assert csopc.triggered_alerts == 0
63
68
  assert csopc.resolved_alerts == 1
64
69
  assert not csopc.elapsed_times
70
+
71
+ art = alert_stats["AlertmanagerReceiverTest"]
72
+ assert art.triggered_alerts == 1
73
+ assert art.resolved_alerts == 1
74
+ assert median(art.elapsed_times) == 300