ZerocIce latency metrics collector
Project description
# ZerocIce latency metrics collector
#### Simple Example
```python
from ice_latency_metrics_collector import latency_metrics_factory
import MyIceModule
with_latency_metrics = latency_metrics_factory(enabled=True)
@with_latency_metrics
class MyServant(MyIceModule.MyServant):
# This method send timings to statsd
def my_proxyed_method(self):
# your implementation
pass
# This method don't send timings to statsd
def my_custom_internal_method(self):
# your implementation
pass
```
#### Statsd Configuration
`config` param in factory will be passed to [StatsClient constructor](http://statsd.readthedocs.io/en/v3.2.1/configure.html)
```python
latency_metrics_factory(enabled=True, config=dict(host='statsd'))
```
#### Logging configuration
You need to use standard python logging configuration file.
```python
latency_metrics_factory(enabled=True, logging_conf_path=your_logging_conf_path)
```
#### Disable or enable
Example with env
```python
import os
METRICS_ENABLED = os.environ.get('METRICS_ENABLED', 'false').lower() == 'true'
latency_metrics_factory(enabled=METRICS_ENABLED)
```
#### Simple Example
```python
from ice_latency_metrics_collector import latency_metrics_factory
import MyIceModule
with_latency_metrics = latency_metrics_factory(enabled=True)
@with_latency_metrics
class MyServant(MyIceModule.MyServant):
# This method send timings to statsd
def my_proxyed_method(self):
# your implementation
pass
# This method don't send timings to statsd
def my_custom_internal_method(self):
# your implementation
pass
```
#### Statsd Configuration
`config` param in factory will be passed to [StatsClient constructor](http://statsd.readthedocs.io/en/v3.2.1/configure.html)
```python
latency_metrics_factory(enabled=True, config=dict(host='statsd'))
```
#### Logging configuration
You need to use standard python logging configuration file.
```python
latency_metrics_factory(enabled=True, logging_conf_path=your_logging_conf_path)
```
#### Disable or enable
Example with env
```python
import os
METRICS_ENABLED = os.environ.get('METRICS_ENABLED', 'false').lower() == 'true'
latency_metrics_factory(enabled=METRICS_ENABLED)
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for ice_latency_metrics_collector-0.1.0a0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88dc1ba1d24bdc949c26db039483003dc2000c2e3c566b3c4366bab2f0046801 |
|
MD5 | f9ec50a76ca432768cda0448ef241394 |
|
BLAKE2b-256 | 9f64b29e48452f8c0ff3b0a66fe3adb51dddeac7653f5953f2793ed7134e0603 |