pip_services3_components.count.NullCounters module

pip_services3_components.count.NullCounter

Null counter implementation

copyright

Conceptual Vision Consulting LLC 2018-2019, see AUTHORS for more details.

license

MIT, see LICENSE for more details.

class pip_services3_components.count.NullCounters.NullCounters

Bases: pip_services3_components.count.ICounters.ICounters

Dummy implementation of performance counters that doesn’t do anything. It can be used in testing or in situations when counters is required but shall be disabled.

begin_timing(name: str)pip_services3_components.count.CounterTiming.CounterTiming

Begins measurement of execution time interval. It returns CounterTiming object which has to be called at 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.

timestamp_now(name: str)

Records the current time as a timestamp.

Parameters

name – a counter name of Timestamp type.