跳转到主要内容

未提供项目描述

项目描述

Muffin-Metrics – 将数据从Muffin应用程序发送到Graphite/StatsD。

Build Status http://img.shields.io/pypi/v/muffin-metrics.svg?style=flat-square http://img.shields.io/pypi/dm/muffin-metrics.svg?style=flat-square Donate

要求

  • python >= 3.3

安装

Muffin-Metrics 应使用pip安装

pip install muffin-metrics

用法

muffin_metrics 添加到您的Muffin应用程序配置中的 PLUGINS

选项

METRICS_BACKENDS – 格式为([])的Graphite后端

METRICS_BACKENDS = (
    ('udp': 'udp://address:port'),
    ('tcp': 'tcp://address:port'),
    ('statsd_udp': 'udp+statsd://address:port'),
    ('statsd_tcp': 'tcp+statsd://address:port'),
)
METRICS_DEFAULT = 'udp'

METRICS_DEFAULT – 默认后端(None)

METRICS_FAIL_SILENTLY – 不要引发连接的异常(False)

METRICS_MAXUDPSIZE – UDP消息的最大大小(512)

METRICS_PREFIX – 度量指标的名称前缀(muffin.)

用法

@app.register('/my')
def my_view(request):
    # Context manager (group metrics to pipeline and send them as one message)
    with (yield from app.ps.metrics.client()) as metrics:
        metrics.send(42, path='answer.to.the.ultimate.question')
        # ...
        metrics.send(31, path='some.some')

    # Send data
    yield from app.ps.metrics.send(100, path='one.hungred', backend='mybackend')

    # Create client and send data
    metrics = yield from app.ps.metrics.client(backend='tcp')
    metrics.send('twenty.four', 24)
    metrics.disconnect()

    # Send data to statsd
    with (yield from app.ps.metrics.client(backend='statsd_tcp')) as client:
        client.incr('request.method.%s' % request.method)
        client.timing('response.time', timer.ms)
        client.incr('response.status.%s' % response.status)

错误跟踪器

如果您有任何建议、错误报告或不满,请向https://github.com/klen/muffin-metrics/issues 的问题跟踪器报告。

贡献

Muffin-Metrics的开发发生在: https://github.com/klen/muffin-metrics

贡献者

  • klen (Kirill Klenov)

许可证

许可协议为MIT许可证

项目详细信息


下载文件

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

源代码分发

muffin-metrics-0.1.4.tar.gz (6.1 kB 查看哈希值)

上传时间 源代码

构建分发

muffin_metrics-0.1.4-py3-none-any.whl (7.0 kB 查看哈希值)

上传时间 Python 3

由以下支持