跳转到主要内容

Airflow Dags的优先级标签

项目描述

airflow-priority

Airflow Dags的优先级标签

Build Status codecov License PyPI

概述

此仓库提供了Airflow 插件,用于优先级驱动的 DAG 失败警报。简单来说,只需在他们的 DAG 中添加一个 标签(P1, P2, P3, P4, P5),那么该 DAG 将向以下服务发送通知:

其中 P1 代表最高优先级,而 P5 代表最低。

安装

您可以从 pip 安装

pip install airflow-priority

或通过 conda

conda install airflow-priority -c conda-forge

集成

集成 指标/标签
New Relic airflow.custom.priority.p{1,2,3,4,5}.{failed,succeeded,running}
Datadog airflow.custom.priority.p{1,2,3,4,5}.{failed,succeeded,running}
Discord N/A
Slack N/A
Symphony N/A

Datadog

按照他们的指南创建一个新的 Datadog API 密钥

将此 API 密钥复制到您的 airflow.cfg 中,如下所示

[priority.datadog]
api_key = the api key

确保您的 DAG 已配置标签并运行了一些,通常有一个故意失败的 P1 DAG 来测试集成会更方便。有了这个,您现在可以为标签创建自定义监控器

Discord

按照 discord.py 库的指南创建一个新的 Discord 应用程序。

将您的 bot 令牌复制到您的 airflow.cfg 中,如下所示

[priority.discord]
token = the bot's token
channel = the numerical channel ID, from the url or by right clicking

确保您的机器人被邀请进入任何私人频道。

New Relic

根据他们的指南创建一个新的New Relic API密钥 (点击此处查看指南)。注意,类型应该是 INGEST - LICENSE

将此 API 密钥复制到您的 airflow.cfg 中,如下所示

[priority.newrelic]
api_key = the api key

在New Relic UI的“查询您的数据”下,您可以创建一个新的自定义指标的查询

SELECT sum(`airflow.custom.priority.p1.failed`) FROM Metric FACET dag

有了这个,您现在可以 创建一个自定义警报。对于快速警报,我们推荐以下参数

Window duration - 30 seconds
Sliding window aggregation - Disabled
Slide by interval - Not set
Streaming method - Event timer
Timer - 5 seconds

Fill data gaps with - None
Evaluation delay - Not set

Thresholds: Critical: Query result is above or equals 1 at least once in 1 minute

Slack

按照 Slack 快速入门 指引配置一个新的Slack应用程序。

确保您的应用程序具有以下公共和私人频道访问权限

  • channels:read
  • groups:read
  • chat:write

启用并安装您的Slack应用程序到您的工位,并将其添加到您希望它发布消息的任何频道。

将您的Slack应用程序的Oauth Token(以 xoxb- 开头)和您希望使用的频道复制到您的 airflow.cfg 文件中,如下所示

[priority.slack]
token = xoxb-...
channel = channel-name

Symphony

文档即将推出!

[priority.symphony]
room_name = the room name
message_create_url = https://mycompany.symphony.com/agent/v4/stream/SID/message/create
cert_file = path/to/my/cert.pem
key_file = path/to/my/key.pem
session_auth = https://mycompany-api.symphony.com/sessionauth/v1/authenticate
key_auth = https://mycompany-api.symphony.com/keyauth/v1/authenticate
room_search_url = https://mycompany.symphony.com/pod/v3/room/search

许可

本软件根据Apache 2.0许可协议授权。有关详细信息,请参阅 LICENSE 文件。

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分布

airflow_priority-0.1.3.tar.gz (17.7 kB 查看散列)

上传时间

构建分布

airflow_priority-0.1.3-py3-none-any.whl (24.4 kB 查看散列)

上传时间 Python 3

由以下机构支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误日志 StatusPage StatusPage 状态页面