Registry / devops / apache-airflow-providers-opsgenie

apache-airflow-providers-opsgenie

JSON →
library5.10.4pypypi✓ verified 22d ago

The `apache-airflow-providers-opsgenie` package integrates Apache Airflow with Opsgenie, a modern incident management platform. It allows Airflow DAGs to create, close, and manage alerts and incidents within Opsgenie, enhancing observability and response capabilities for workflows. The current version is 5.10.3, and it follows the frequent release cadence typical of Apache Airflow providers.

pip install apache-airflow-providers-opsgenie
INSTALL
IMPORT
SIG · APACHE-AIRFLOW-PRO
A
apache-airflow-providers-opsgenie
devopspythonv5.10.4
Install
24.7s avg
Import
5628ms
Disk
262MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.10.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 5.840s · 259.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 24.7s · import 5.416s · 258MB
262MB installed
● package 262MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

OpsgenieCreateAlertOperator
from airflow.providers.opsgenie.operators.opsgenie import OpsgenieCreateAlertOperator
OpsgenieCloseAlertOperator
from airflow.providers.opsgenie.operators.opsgenie import OpsgenieCloseAlertOperator
OpsgenieNotifier
from airflow.providers.opsgenie.notifications.opsgenie import OpsgenieNotifier
OpsgenieAlertHook
from airflow.providers.opsgenie.hooks.opsgenie import OpsgenieAlertHook

This quickstart demonstrates how to use the `OpsgenieCreateAlertOperator` to trigger an alert and `OpsgenieCloseAlertOperator` to resolve it within an Airflow DAG. It assumes an Opsgenie connection named `opsgenie_default` is configured in the Airflow UI with the Opsgenie API Key. The `alert_id` from the created alert is XCom-pulled to close the corresponding alert.

import os from datetime import datetime from airflow.models.dag import DAG from airflow.providers.opsgenie.operators.opsgenie import ( OpsgenieCreateAlertOperator, OpsgenieCloseAlertOperator, ) # Ensure 'opsgenie_default' connection is configured in Airflow UI: # Admin -> Connections # Conn Id: opsgenie_default # Conn Type: Opsgenie # Host: (Optional, defaults to https://api.opsgenie.com) # Password: Your Opsgenie API Key (e.g., os.environ.get('OPSGENIE_API_KEY', '')) with DAG( dag_id="opsgenie_alert_example_dag", schedule_interval=None, start_date=datetime(2023, 1, 1), catchup=False, tags=["opsgenie", "alerting"], ) as dag: create_alert = OpsgenieCreateAlertOperator( task_id="create_opsgenie_alert", message="High priority alert from Airflow DAG!", recipients=["team_id:your_team_id"], # Or 'email:your_email@example.com' priority="P1", teams=[{"name": "your_team_name"}], description="Automated alert for critical workflow failure.", tags=["airflow", "critical", "pipeline"], opsgenie_conn_id="opsgenie_default", ) # In a real scenario, this would typically be triggered by another task's success or failure close_alert = OpsgenieCloseAlertOperator( task_id="close_opsgenie_alert", identifier="{{ task_instance.xcom_pull(task_ids='create_opsgenie_alert')['alert_id'] }}", identifier_type="id", user="Airflow Automated System", note="Alert successfully resolved by downstream tasks.", opsgenie_conn_id="opsgenie_default", ) create_alert >> close_alert
airflow --version
Debug
Known issues
breakingThe current version of `apache-airflow-providers-opsgenie` (5.x.x) requires Apache Airflow version 2.11.0 or higher. Installing on older Airflow versions (<2.11.0) will automatically upgrade Airflow, potentially causing database migration issues if not handled manually.
fix
Ensure your Apache Airflow environment is upgraded to at least 2.11.0 before installing or upgrading this provider. After Airflow upgrade, run `airflow upgrade db` if prompted.
affects: < 5.0.0
breakingThe `OpsgenieAlertOperator` was removed in provider version 5.0.0. It has been replaced by `OpsgenieCreateAlertOperator` for creating alerts and `OpsgenieDeleteAlertOperator` for deleting alerts. Additionally, the `hooks.opsgenie_alert` import path was removed.
fix
Migrate your DAGs to use `OpsgenieCreateAlertOperator` and `OpsgenieCloseAlertOperator` (or `OpsgenieDeleteAlertOperator`) and update import paths accordingly. Refer to the provider's changelog for specific operator and hook changes.
affects: >= 5.0.0
breakingIn provider version 3.0.0, significant changes were introduced to `OpsgenieAlertHook`. The constructor no longer accepts additional arguments or keyword arguments, `get_conn` now returns an `opsgenie_sdk.AlertApi` object instead of a `requests.Session`, and the `execute` method was replaced by `create_alert`. Payload keys for fields like `visible_to` and `request_id` were also standardized to use snake_case instead of camelCase.
fix
Review existing usages of `OpsgenieAlertHook` to adapt to the new constructor signature, method names (`create_alert`), return types, and payload key formatting (e.g., `visible_to` instead of `visibleTo`).
affects: >= 3.0.0
gotchaTo authenticate with Opsgenie, you must create an Airflow connection. The Opsgenie API Key should be stored in the 'Password' field of an 'Opsgenie' type connection in the Airflow UI (Admin -> Connections). The default connection ID is `opsgenie_default`.
fix
Configure an Airflow connection with 'Conn Type: Opsgenie' and set your API Key in the 'Password' field. Ensure the `conn_id` used in your operators/notifiers matches this connection ID.
affects: All
gotchaFor new Airflow installations, especially when `pip` version 20.3 was released, resolver issues could occur. While less common with modern `pip` versions, if you encounter installation errors, downgrading pip or using `--use-deprecated=legacy-resolver` might be necessary.
fix
If facing installation issues, try `pip install --upgrade pip==20.2.4` or `pip install apache-airflow-providers-opsgenie --use-deprecated=legacy-resolver`.
affects: Older pip versions (e.g., pip 20.3)
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'airflow.providers.opsgenie'
The 'apache-airflow-providers-opsgenie' package is not installed.
fix
Install the package using 'pip install apache-airflow-providers-opsgenie'.
ImportError: cannot import name 'OpsgenieAlertOperator' from 'airflow.providers.opsgenie.operators.opsgenie_alert'
The 'OpsgenieAlertOperator' class has been moved or renamed in the 'apache-airflow-providers-opsgenie' package.
fix
Update the import statement to 'from airflow.providers.opsgenie.operators.opsgenie import OpsgenieAlertOperator'.
AttributeError: module 'airflow.providers.opsgenie.hooks.opsgenie' has no attribute 'OpsgenieHook'
The 'OpsgenieHook' class has been moved or renamed in the 'apache-airflow-providers-opsgenie' package.
fix
Update the import statement to 'from airflow.providers.opsgenie.hooks.opsgenie_alert import OpsgenieAlertHook'.
Could not find connection opsgenie_default
The default Opsgenie connection ID (`opsgenie_default`) is not configured in Airflow, or the configured connection is missing required details like the API key.
fix
In the Airflow UI, navigate to Admin -> Connections, then create a new connection (or edit an existing one) with `Conn Id`: `opsgenie_default`, `Conn Type`: `Opsgenie`, and provide a valid Opsgenie API Key.
Sending 'POST' to url: https://api.opsgenie.com/v2/alerts <Response [202]> {'result': 'Request will be processed', ... No alerts are ever sent
The Opsgenie API accepts the alert request (HTTP 202), but the alert does not appear in Opsgenie or trigger notifications because critical routing information, such as the `responders` field, is missing or incorrect in the alert payload.
fix
Ensure that the `responders` parameter is explicitly included in your `OpsgenieAlertOperator` or `OpsgenieAlertHook` payload, specifying the correct team names, users, or escalations as configured in Opsgenie.
Upgrade
Version history
5.10.4latest on PyPI · released Jun 7, 2026
Audit
Dependencies
apache-airflowrequiredRequired base for all Airflow providers. Minimum version 2.11.0 is needed for provider version 5.x.x.
opsgenie-sdkrequiredOfficial Python SDK for interacting with the Opsgenie API, used by the provider's hooks and operators.
Agent activity
62 hits · last 30 days
node
52
OpenAI (training)
2
Resources
apache-airflow-providers-opsgenie — pip install apache-airflow-providers-opsgenie · libregistry