Skip to main content

No project description provided

Project description

asyncstatsd

Installation

$ pip install asyncstatsd

Usage

Pure statsd

from asyncstatsd.client import StatsdClient


def foo(statsd):
    statsd.incr('some.counter')
    statsd.timing('some.timer', 320)


async def bar(statsd):
   statsd.incr('some.counter')
   statsd.timing('some.timer', 320)
   with statsd.timer('some.timer'):
       await asyncio.sleep(1)


async def main():
    client = StatsdClient('localhost', 8125)
    await client.connect()
    foo(client)
    await bar(client)

Statsd extended with Datadog tags

from asyncstatsd.client import DatadogClient


def foo(statsd):
    statsd.incr('some.counter', tags=dict(tag1='value1', tag2='value2'))
    statsd.timing('some.timer', 320, tags=dict(tag1='value1', tag2='value2'))


async def bar(statsd):
   statsd.incr('some.counter', tags=dict(tag1='value1', tag2='value2'))
   statsd.timing('some.timer', 320, tags=dict(tag1='value1', tag2='value2')
   with statsd.timer('some.timer', tags=dict(tag1='value1', tag2='value2'):
       await asyncio.sleep(1)


async def main():
    client = DatadogClient('localhost', 8125)
    await client.connect()
    foo(client)
    await bar(client)

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

asyncstatsd-1.0.0a0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

asyncstatsd-1.0.0a0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file asyncstatsd-1.0.0a0.tar.gz.

File metadata

  • Download URL: asyncstatsd-1.0.0a0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.1 Linux/6.6.13-amd64

File hashes

Hashes for asyncstatsd-1.0.0a0.tar.gz
Algorithm Hash digest
SHA256 1071d9dd0ca1fd651335633cd91e51abd2110c0ca0aeb4c3831a311f0503af32
MD5 1f3c9902a72ce0d92a4da9dc9bc61abb
BLAKE2b-256 9ba7f9ece4760190df6d3004c0ab47f06ae44e8ea438c8a7cea8749ca13a2673

See more details on using hashes here.

File details

Details for the file asyncstatsd-1.0.0a0-py3-none-any.whl.

File metadata

  • Download URL: asyncstatsd-1.0.0a0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.1 Linux/6.6.13-amd64

File hashes

Hashes for asyncstatsd-1.0.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 e34f8d056c4f0146d17e58624992d88127d7d7f23a0550cba013af06c2a60f12
MD5 00796c2ef4a3af180bf0de2493481542
BLAKE2b-256 0026f54e54b6327de070f2de935df13501c8ecc0eb51917192f8c67dd980472b

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