Skip to content

Commit

Permalink
chore(AlertmanagerWebhookLog): Remove unused code
Browse files Browse the repository at this point in the history
- fix typing
- remove redundant comment
  • Loading branch information
balamurali27 committed Jun 28, 2024
1 parent 068247a commit 0f2088b
Showing 1 changed file with 2 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,6 @@ def after_insert(self):
deduplicate=True,
)

def ongoing_reaction_exists(self, instance):
ongoing_incident_status = frappe.db.get_value( # using get_value for for_update
"Prometheus Alert Reaction",
{
"alert": self.alert,
"instance": instance,
"status": ("in", ["Pending", "Running"]),
},
"status",
for_update=True,
)
return bool(ongoing_incident_status)

def react_for_instance(self, instance) -> "PressJob":
instance_type = self.guess_doctype(instance)
rule: "PrometheusAlertRule" = frappe.get_doc("Prometheus Alert Rule", self.alert)
Expand All @@ -143,7 +130,7 @@ def react(self):
self.append("reaction_jobs", self.react_for_instance(instance))
self.save()

def get_instances_from_alerts_payload(self, payload: str) -> [str]:
def get_instances_from_alerts_payload(self, payload: str) -> set[str]:
instances = []
payload = json.loads(payload)
instances.extend(
Expand Down Expand Up @@ -268,7 +255,7 @@ def parsed_group_labels(self) -> dict:
return parsed

def ongoing_incident_exists(self) -> bool:
ongoing_incident_status = frappe.db.get_value( # using get_value for for_update
ongoing_incident_status = frappe.db.get_value(
"Incident",
{
"alert": self.alert,
Expand Down

0 comments on commit 0f2088b

Please sign in to comment.