File: contextmanager.py

package info (click to toggle)
aiodogstatsd 0.16.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 296 kB
  • sloc: python: 1,080; makefile: 70; sh: 19
file content (17 lines) | stat: -rw-r--r-- 392 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import asyncio
from random import random

import aiodogstatsd


async def main():
    async with aiodogstatsd.Client(
        host="0.0.0.0", port=9125, constant_tags={"whoami": "I am Batman!"}
    ) as client:
        for _ in range(5000):
            client.timing("fire", value=random())


if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(main())