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
- Host: GitHub
- URL: https://github.com/cxmcc/cwtimer
- Owner: cxmcc
- License: mit
- Created: 2017-08-18T07:25:08.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-21T19:03:40.000Z (almost 9 years ago)
- Last Synced: 2025-11-02T11:12:41.028Z (8 months ago)
- Topics: aws, boto3, cloudwatch, python
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
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