将计时和异常统计信息发送到riemann
项目描述
介绍性博客文章: http://www.spootnik.org/entries/2013/05/21_using-riemann-to-monitor-python-apps.html
此库提供用于使用 http://riemann.io 报告Python函数的计时和异常。
安装
Pip
pip install riemann_wrapper
Pypi: https://pypi.python.org/pypi/riemann_wrapper
手册
python setup.py install
使用
提供度量名称和一个bernhard客户端进行计时
import bernhard from riemann_wrapper import wrap_riemann, riemann_wrapper riemann = bernhard.Client() @wrap_riemann("cpu-intensive-task", client=riemann) def do_something_cpu_intensive(): # [...]
调用选项
以下关键字参数可以传递给 wrap_riemann
client:发送事件的 bernhard.Client 实例
tags:附加到riemann事件的标签
host:覆盖事件的主机名
logger:一个标准的Python记录器,可以将传输错误记录到其中
另请参阅,通过以下方式调用 riemann_wrapper 来创建一个新的包装函数
import bernhard from riemann_wrapper import wrap_riemann, riemann_wrapper riemann = bernhard.Client() my_wrapper = riemann_wrapper(client=bernhard.Client(), prefix="myapp.") @my_wrapper("cpu-intensive-task") def do_something_cpu_intensive(): # [...]
以下关键字参数可以传递给 riemann_wrapper
client:发送事件的 bernhard.Client 实例
global_tags:所有发送事件中存在的标签。默认值:['python']。
host:覆盖所有事件的默认主机名。默认值:None。
logger:一个标准的Python记录器,可以将传输错误记录到其中。默认值:None。
prefix:将给定的字符串预置于所有事件服务。默认值:python。
exception_state:异常发送的状态。默认值:'warning'。
send_exceptions:布尔值或可调用对象,该对象接受一个异常作为参数并返回一个布尔值,以指定是否将特定异常发送到riemann。默认值:True。
项目详情
关闭
riemann_wrapper-0.6.2.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | dd6d2cfa155b80e0d913241291ad47454b4131ccdef3f93ccc8c233b98517e09 |
|
MD5 | f11910a8aa47c4e3a8fc1beb7f96642b |
|
BLAKE2b-256 | 5fdb83d74e50d1532afcc12dd53d89d1957765c5bc5c94bc00f8a68ad2434e78 |