Skip to content

Commit

Permalink
fix(pagerduty): logs
Browse files Browse the repository at this point in the history
  • Loading branch information
talboren committed Nov 26, 2024
1 parent 6972c6e commit 7478121
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions keep/providers/pagerduty_provider/pagerduty_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from keep.providers.models.provider_config import ProviderConfig, ProviderScope
from keep.providers.providers_factory import ProvidersFactory


# Todo: think about splitting in to PagerdutyIncidentsProvider and PagerdutyAlertsProvider
# Read this: https://community.pagerduty.com/forum/t/create-incident-using-python/3596/3

Expand Down Expand Up @@ -452,10 +451,17 @@ def _trigger_incident(
}

r = requests.post(url, headers=headers, data=json.dumps(payload))
r.raise_for_status()
response = r.json()
self.logger.info("Incident triggered")
return response
try:
r.raise_for_status()
response = r.json()
self.logger.info("Incident triggered")
return response
except Exception as e:
self.logger.error(
"Failed to trigger incident",
extra={"response_text": r.text},
)
raise e

def dispose(self):
"""
Expand Down

0 comments on commit 7478121

Please sign in to comment.