Last active
November 9, 2020 10:45
-
-
Save judoole/ee48814e4964755ed140b494ef9ffd32 to your computer and use it in GitHub Desktop.
Blogpost on OpsGenie alerting in Airflow https://medium.com/p/239ddea61d0a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OpsGenieExceptionReporter(): | |
def __init__(self, connection_id: str = opsgenie_default,) -> None: | |
self.connection_id = connection_id | |
def __call__(self, context) -> requests.Response: | |
ti: TaskInstance = context["ti"] | |
json = { | |
"message": f"Something went terribly wrong with {ti.task_id}", | |
"description": f"See more at {ti.log_url}", | |
"responders": [{"name": "my-fancy-team", "type": "team"}], | |
"alias": f"{ti.dag_id}.{ti.task_id}-{context['ds']}" | |
} | |
return OpsgenieAlertHook(self.connection_id).execute(json) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment