Creates a new instance of the counters.
Begins measurement of execution time interval. It returns CounterTiming object which has to be called at CounterTiming.endTiming to end the measurement and update the counter.
a counter name of Interval type.
a CounterTiming callback object to end timing.
Clears (resets) a counter specified by its name.
a counter name to clear.
Clears (resets) all counters.
Configures component by passing configuration parameters.
configuration parameters to be set.
Dumps (saves) the current values of counters.
Ends measurement of execution elapsed time and updates specified counter.
a counter name
execution elapsed time in milliseconds to update the counter.
Gets a counter specified by its name. It counter does not exist or its type doesn't match the specified type it creates a new one.
a counter name to retrieve.
a counter type.
an existing or newly created counter of the specified type.
Gets all captured counters.
a list with counters.
Gets the counters dump/save interval.
the interval in milliseconds.
Increments counter by given value.
a counter name of Increment type.
a value to add to the counter.
Increments counter by 1.
a counter name of Increment type.
Records the last calculated measurement value.
Usually this method is used by metrics calculated externally.
a counter name of Last type.
a last value to record.
Saves the current counters measurements.
current counters measurements to be saves.
Sets the counters dump/save interval.
a new interval in milliseconds.
Sets references to dependent components.
references to locate the component dependencies.
Calculates min/average/max statistics based on the current and previous values.
a counter name of Statistics type
a value to update statistics
Records the given timestamp.
a counter name of Timestamp type.
a timestamp to record.
Records the current time as a timestamp.
a counter name of Timestamp type.
Makes counter measurements as updated and dumps them when timeout expires.
Generated using TypeDoc
Performance counters that periodically dumps counters measurements to logger.
Configuration parameters
References
*:logger:*:*:1.0
ILogger components to dump the captured counters*:context-info:*:*:1.0
(optional) ContextInfo to detect the context id and specify counters sourceCounter
CachedCounters
CompositeLogger
Example
let counters = new LogCounters(); counters.setReferences(References.fromTuples( new Descriptor("pip-services", "logger", "console", "default", "1.0"), new ConsoleLogger() )); counters.increment("mycomponent.mymethod.calls"); let timing = counters.beginTiming("mycomponent.mymethod.exec_time"); try { ... } finally { timing.endTiming(); } counters.dump();