pip_services3_components.count.ICounters module
pip_services3_components.counters.ICounters
Interface for performance counters components.
- copyright
Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.
- license
MIT, see LICENSE for more details.
-
class
pip_services3_components.count.ICounters.
ICounters
Bases:
abc.ABC
Interface for performance counters that measure execution metrics. The performance counters measure how code is performing: how fast or slow, how many transactions performed, how many objects are stored, what was the latest transaction time and so on.
They are critical to monitor and improve performance, scalability and reliability of code in production.
-
begin_timing
(name: str) → <module ‘pip_services3_components.count.CounterTiming’ from ‘/pip_services3_components/count/CounterTiming.py’> Begins measurement of execution time interval. It returns
CounterTiming
object which has to be called atCounterTiming.end_timing()
to end the measurement and update the counter.- Parameters
name – a counter name of Interval type.
- Returns
a
CounterTiming
callback object to end timing.
-
increment
(name: str, value: float) Increments counter by given value.
- Parameters
name – a counter name of Increment type.
value – a value to add to the counter.
-
increment_one
(name: str) Increments counter by 1.
- Parameters
name – a counter name of Increment type.
-
last
(name: str, value: float) Records the last calculated measurement value. Usually this method is used by metrics calculated externally.
- Parameters
name – a counter name of Last type.
value – a last value to record.
-
stats
(name: str, value: float) Calculates min/average/max statistics based on the current and previous values.
- Parameters
name – a counter name of Statistics type
value – a value to update statistics
-
timestamp
(name: str, value: datetime.datetime) Records the given timestamp.
- Parameters
name – a counter name of Timestamp type.
value – a timestamp to record.
-