An open API service indexing awesome lists of open source software.

https://github.com/cxmcc/cwtimer

Pythonic timing tracker with reporting to Cloudwatch
https://github.com/cxmcc/cwtimer

aws boto3 cloudwatch python

Last synced: 5 months ago
JSON representation

Pythonic timing tracker with reporting to Cloudwatch

Awesome Lists containing this project

README

          

cwtimer
=======

'cwtimer' does one simple thing, track the timing of a 'with' statement block and report to AWS Cloudwatch.

Install
-------

.. code-block:: shell

$ pip install cwtimer

Example
-------

.. code-block:: python

from cwtimer import cwtimer
import time

with cwtimer(namespace='MyNameSpace', metric_name='MyMetric',
dimensions={'MyDimension': 'Value'}):
time.sleep(1)
# 1.0s reported to cloudwatch metric

Simpler
-------

.. code-block:: python

from functools import partial
from cwtimer import cwtimer
import time

mytimer = partial(
cwtimer,
namespace='MyNameSpace',
metric_name='MyMetric',
dimensions={'MyDimension': 'Value'},
)

with mytimer():
time.sleep(1)
# 1.0s reported