Skip to main content

No project description provided

Project description

Muffin-Metrics – Send data to Graphite/StatsD from Muffin application.

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

Requirements

  • python >= 3.3

Installation

Muffin-Metrics should be installed using pip:

pip install muffin-metrics

Usage

Add muffin_metrics to PLUGINS in your Muffin Application configuration.

Options

METRICS_BACKENDS – Graphite backends in format ([])

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 – Default backend (None)

METRICS_FAIL_SILENTLY – Don’t raise connection’s exceptions (False)

METRICS_MAXUDPSIZE – Max size of UDP message (512)

METRICS_PREFIX – Prefix for metrics (muffin.)

Usage

@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)

Bug tracker

If you have any suggestions, bug reports or annoyances please report them to the issue tracker at https://github.com/klen/muffin-metrics/issues

Contributing

Development of Muffin-Metrics happens at: https://github.com/klen/muffin-metrics

Contributors

  • klen (Kirill Klenov)

License

Licensed under a MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

muffin-metrics-0.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

muffin_metrics-0.1.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file muffin-metrics-0.1.0.tar.gz.

File metadata

File hashes

Hashes for muffin-metrics-0.1.0.tar.gz
Algorithm Hash digest
SHA256 907889d0e6942b7b9bc73894ce14bee1c85626d0a9fdc8548b24b18f335dc728
MD5 f6e4429a5f231d703863a8d28ae8e0a3
BLAKE2b-256 65a561ac011ea4848ea888e172273e2a6dc10539a3b76dbd16f7b63f3fc9a46f

See more details on using hashes here.

File details

Details for the file muffin_metrics-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for muffin_metrics-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff11cdf781da4e9897f8690436be1dba607304cfbd5013e6f22567b0ce75cc4b
MD5 6a6de270a579ca9c0710f504004360e3
BLAKE2b-256 e07b106398cbb140e43becacaca10f4de69997eab3587a0b190f1998d6825f1e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page