Skip to main content

Generate metrics from AsyncIO applications

Project description

# aiometrics
Generate metrics from asyncio applications


## How to install
As any other python package, use pip or include it in the `install_requires` section of your setup.py

```
pip install aiometrics
```

## Sample

Sample application included below makes usage of the default StdoutDriver to print the metrics into the stdout.
```
# sample.py
import asyncio
import datetime
import random

import aiometrics


@aiometrics.trace
@asyncio.coroutine
def echo_delay():
ms = random.randrange(0, 5000)
t = ms/1000
yield from asyncio.sleep(t)
print(datetime.datetime.now())

@asyncio.coroutine
def main():
while True:
yield from echo_delay()

if __name__ == '__main__':
loop = asyncio.get_event_loop()
asyncio.ensure_future(main())
loop.run_forever()
loop.close()
```

Run this sample with the following command:
```python sample.py```

Here is the sample output:
```
2016-06-20 17:56:03.969607
...
2016-06-20 17:57:03.993648
{"instance": {"hostname": "dmo.local", "id": "acf9842e-c127-4844-8026-d7c518076ac2"}, "traces": {"__main__:echo_delay": {"2016-06-20T23:56:00+00": {"count": 24, "avg": 2510.3998333333334, "min": 229.113, "max": 4986.661}}}}
```

This generates a _per-minute_ report listing metrics for every coroutine function decorated with `@aiometrics.trace`. Metrics include:

- Total number of executions
- Minimum execution time
- Maximum execution time
- Average execution time

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

aiometrics-0.1.3.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file aiometrics-0.1.3.tar.gz.

File metadata

  • Download URL: aiometrics-0.1.3.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for aiometrics-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1870ee7f4fca97870e9884284befb612fe24c7c78d3da15bf7c83472a0d3e5b0
MD5 2db8f03b984574dfeb4db2981f8e0e62
BLAKE2b-256 f1d196e9900a7e395db07325b02637af48fd0f51fb12ed4ce3693b9889b926b0

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