1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
# aiodogstatsd
`aiodogstatsd` is an asyncio-based client for sending metrics to StatsD with support of [DogStatsD](https://docs.datadoghq.com/developers/dogstatsd/) extension.
Library fully tested with [statsd_exporter](https://github.com/prometheus/statsd_exporter) and supports `gauge`, `counter`, `histogram`, `distribution` and `timing` types.
!!! info
`aiodogstatsd` client by default uses _9125_ port. It's a default port for [statsd_exporter](https://github.com/prometheus/statsd_exporter) and it's different from _8125_ which is used by default in StatsD and [DataDog](https://www.datadoghq.com/). Initialize the client with the proper port you need if it's different from _9125_.
## Installation
Just type:
```sh
pip install aiodogstatsd
```
...or if you're interested in integration with [`AIOHTTP`](https://aiohttp.readthedocs.io/) or [`Starlette`](https://www.starlette.io) frameworks specify corresponding extras:
```sh
pip install aiodogstatsd[aiohttp,starlette]
```
## At a glance
Just simply use client as a context manager and send any metric you want:
```python
import asyncio
import aiodogstatsd
async def main():
async with aiodogstatsd.Client() as client:
client.increment("users.online")
asyncio.run(main())
```
|