MQ牧场
mbq.ranch的Python项目详细描述
牧场
用于芹菜的标准化工具、监视和重试逻辑
安装
Ranch是一个django应用程序。要将ranch与芹菜一起使用,请将以下内容添加到您的设置文件中:
INSTALLED_APPS=[...'mbq.ranch']RANCH={'env':ENV_NAME,# e.g. production, development'service':MY_SERVICE_NAME,# e.g. os-core}
功能
指标
任何安装了Ranch的应用程序都将在the Celery/Ranch DataDog Dashboard中提供芹菜指标
监视器
todo:生成发票监视器后,包括指向它们的链接
您可以使用ranch提供的度量设置应用程序的监视器。要开始,您可能需要复制发票的监视器。
死信队列
失败的芹菜作业将存储在应用程序的数据库中,以供检查和重新处理。Ranch为此提供了一个管理界面。
有关示例,请参见OS Core's Ranch Admin。
相关ids
牧场可以通过你的芹菜作业流相关IDranch将not更改任何日志配置,因此作为correlation id实现的一部分,您仍然需要这样做。
要使用相关ID功能,请添加以下设置:
RANCH={...,'correlation':{'getter':getter_fn,# callable with no args that returns the current correlation ID'setter':setter_fn,# callable with one arg which should be set as the current correlation ID},}
附加错误标记
ranch提供了一个钩子,可以向错误项度量添加额外的标记信息。这在os core中用于将每个错误标记为属于特定团队。
要使用此功能,请添加以下设置:
RANCH={...,# tags_fn takes a single arg (the Ranch Task object that failed)# and should return a list of strings in the format "tag_name:tag_value"# See OS Core's usage for an example'extra_error_queue_tags_fn':tags_fn,}