Skip to content

jruere/aiostatsd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

aiostatsd

An asyncio statsd client for Python >= 3.4. The underlying protocol is written in cython, which we can all admit is pretty cool.

It automatically batches multiple metrics in single UDP packets, with a configurable target packet size of 512 bytes. The flush interval defaults to 0.5 seconds, but can also be configured.

Install

pip install aiostatsd

Example

import asyncio
from aiostatsd.client import StatsdClient

async def go():
    client = StatsdClient("127.0.0.1", 8015)
    asyncio.ensure_future(client.run())
    with client.timer("something", rate=0.1):
        await asyncio.sleep(0.5)
    client.incr("x")
    client.decr("y", 5)
    client.send_gauge("queue_depth", 50)
    await client.stop()

if __name__ == '__main__':
    asyncio.get_event_loop().run_until_complete(go())

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%