{"id":3877,"library":"apache-airflow-providers-pagerduty","title":"PagerDuty Airflow Provider","description":"The `apache-airflow-providers-pagerduty` package provides Apache Airflow integrations for PagerDuty, enabling users to send incident notifications and interact with the PagerDuty API directly from Airflow DAGs. It supports both the PagerDuty REST API and Events API. The current version is 5.2.4 and it follows the Apache Airflow provider release cadence, with frequent updates addressing features, bug fixes, and compatibility.","status":"active","version":"5.2.4","language":"en","source_language":"en","source_url":"https://github.com/apache/airflow/tree/main/airflow/providers/pagerduty","tags":["apache-airflow","pagerduty","provider","notification","hook","incident-management"],"install":[{"cmd":"pip install apache-airflow-providers-pagerduty","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Core Apache Airflow library, required for all providers.","package":"apache-airflow","version":">=2.11.0"},{"reason":"Official PagerDuty Python client library used by the provider.","package":"pagerduty","version":">=2.3.0"},{"reason":"Provides common compatibility features for providers, used with `[common.compat]` extra.","package":"apache-airflow-providers-common-compat","version":">=1.10.1","optional":true},{"reason":"Provides HTTP connection functionality, used with `[http]` extra.","package":"apache-airflow-providers-http","optional":true}],"imports":[{"symbol":"PagerdutyHook","correct":"from airflow.providers.pagerduty.hooks.pagerduty import PagerdutyHook"},{"symbol":"send_pagerduty_notification","correct":"from airflow.providers.pagerduty.notifications.pagerduty import send_pagerduty_notification"},{"note":"Import from the specific 'pagerduty' module within 'notifications'.","wrong":"from airflow.providers.pagerduty.notifications import PagerdutyNotifier","symbol":"PagerdutyNotifier","correct":"from airflow.providers.pagerduty.notifications.pagerduty import PagerdutyNotifier"}],"quickstart":{"code":"import os\nfrom datetime import datetime\n\nfrom airflow.models.dag import DAG\nfrom airflow.operators.bash import BashOperator\nfrom airflow.providers.pagerduty.notifications.pagerduty import send_pagerduty_notification\n\nPAGERDUTY_INTEGRATION_KEY = os.environ.get('PAGERDUTY_INTEGRATION_KEY', '')\n\nwith DAG(\n    dag_id='pagerduty_notification_example',\n    start_date=datetime(2023, 1, 1),\n    schedule=None,\n    catchup=False,\n    tags=['pagerduty', 'notification'],\n    on_failure_callback=[\n        send_pagerduty_notification(\n            summary=\"The DAG {{ dag.dag_id }} failed!\",\n            severity=\"critical\",\n            source=\"airflow dag_id: {{dag.dag_id}}\",\n            dedup_key=\"{{dag.dag_id}}-failure\",\n            component=\"airflow\",\n            integration_key=PAGERDUTY_INTEGRATION_KEY,\n        )\n    ]\n) as dag:\n    start_task = BashOperator(\n        task_id='start_task',\n        bash_command='echo \"Starting DAG...\"',\n    )\n\n    failing_task = BashOperator(\n        task_id='failing_task',\n        bash_command='exit 1', # This task will intentionally fail\n        on_failure_callback=[\n            send_pagerduty_notification(\n                summary=\"Task {{ ti.task_id }} failed in DAG {{ dag.dag_id }}\",\n                severity=\"error\",\n                source=\"airflow task_id: {{ti.task_id}}\",\n                dedup_key=\"{{dag.dag_id}}-{{ti.task_id}}-failure\",\n                component=\"airflow\",\n                integration_key=PAGERDUTY_INTEGRATION_KEY,\n            )\n        ]\n    )\n\n    success_task = BashOperator(\n        task_id='success_task',\n        bash_command='echo \"DAG succeeded!\"',\n    )\n\n    start_task >> failing_task >> success_task\n","lang":"python","description":"This quickstart demonstrates how to use `send_pagerduty_notification` as an `on_failure_callback` for both a DAG and a specific task. Ensure you have configured a PagerDuty connection in Airflow (Admin -> Connections, type 'Pagerduty' or 'Pagerduty Events') or provide the `integration_key` directly. For security, it's recommended to store sensitive keys in Airflow Connections or a secret backend, and retrieve them via `BaseHook.get_connection`."},"warnings":[{"fix":"Refer to the official changelog for specific removals. Update your code to use current API methods.","message":"Provider version 5.0.0 removed all deprecated classes, parameters, and features. Ensure your code does not rely on any previously deprecated components.","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Upgrade your Apache Airflow environment to at least version 2.11.0. If upgrading from Airflow <2.1.0, an `airflow upgrade db` might be necessary.","message":"Minimum Apache Airflow version required is 2.11.0. Older Airflow versions are not supported.","severity":"breaking","affected_versions":"<5.0.0 requires Airflow <2.1.0, >=5.0.0 requires >=2.1.0, >=5.2.4 requires >=2.11.0"},{"fix":"Upgrade your Python environment to version 3.10 or later.","message":"Python 3.9 support was dropped with version 5.0.1. Ensure your environment uses Python 3.10 or newer.","severity":"breaking","affected_versions":">=5.0.1"},{"fix":"Select the correct connection type in the Airflow UI (Admin -> Connections) and provide the corresponding API token or Integration Key in the designated field. For Events API, the integration key can often be passed directly to the `send_pagerduty_notification` function.","message":"When configuring a PagerDuty connection in Airflow, there are two main types: 'Pagerduty' for the REST API (requires an API token in the 'Password' field) and 'Pagerduty Events' for the Events API (requires an Integration Key). Using the wrong type or credential will lead to authentication failures.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Prefer using the `send_pagerduty_notification` function for DAG/task callbacks. If using `PagerdutyNotifier`, ensure your provider version is sufficiently updated and test the notification flow thoroughly.","message":"An issue (reported in Jan 2025 as #45626) indicated that the `PagerdutyNotifier` class's `notify` method was attempting to use a `create_event` method that no longer existed, leading to failed notifications. While this might be resolved in current versions, using the `send_pagerduty_notification` function directly in callbacks is often a more robust and commonly demonstrated approach.","severity":"gotcha","affected_versions":"Potentially provider versions around 4.x - 5.0.x (check specific patch notes for resolution)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}