Skip to content

Commit

Permalink
provider: fix event preparation for appdynamics
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirFilonov committed Nov 18, 2024
1 parent 4ed3f3c commit c0408b4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions keep/providers/appdynamics_provider/appdynamics_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from urllib.parse import urlencode, urljoin

import pydantic
import requests
import requestss
from dateutil import parser

from keep.api.models.alert import AlertDto, AlertSeverity
from keep.contextmanager.contextmanager import ContextManager
Expand Down Expand Up @@ -267,7 +268,7 @@ def __create_http_response_template(self, keep_api_url: str, api_key: str):
)
res = res.json()
temp.close()
if res["success"] == "True":
if res["success"] == "True" or res["success"] is True:
self.logger.info("HTTP Response template Successfully Created")
else:
self.logger.info("HTTP Response template creation failed", extra=res)
Expand Down Expand Up @@ -393,10 +394,16 @@ def _format_alert(
id=event["id"],
name=event["name"],
severity=AppdynamicsProvider.SEVERITIES_MAP.get(event["severity"]),
lastReceived=event["lastReceived"],
lastReceived=parser.parse(event["lastReceived"]).isoformat(),
message=event["message"],
description=event["description"],
event_id=event["event_id"],
url=event["url"],
source=["appdynamics"],
)

@staticmethod
def parse_event_raw_body(raw_body: bytes | dict) -> dict:
if isinstance(raw_body, dict):
return raw_body
return json.loads(raw_body, strict=False)

0 comments on commit c0408b4

Please sign in to comment.