Creates a new instance of the performance counters.
Creates a new CachedCounters object.
Creates and starts a new [[Timing]], which will call this object's endTiming method once timing stops.
the name of the counter to include in the callback.
Removes the [[Counter]] with the given name from this object's cache.
the name of the counter to remove.
Removes all [[Counter Counters]] from this object's cache.
Closes component and frees used resources.
(optional) transaction id to trace execution through call chain.
callback function that receives error or null no errors occured.
Configures component by passing configuration parameters.
configuration parameters to be set.
Dumps the [[Counter Counters]] that are stored in this object's cache to memory.
Method that is called by a [[Timing Timing]] once timing has ended.
the name of the counter that was being timed.
the time elapsed since timing began.
Looks for a [[Counter]] with the given name and type within this object's cache. If none are found, then a new [[Counter]] of the given [[CounterType type]] is created, added to the cache, and returned.
If the need for cache resetting is detected, calling this method will trigger the reset.
the name of the counter to retrieve.
the counter's type.
the counter found in the cache or the one created (if none were found).
Retrieves the [[Counter Counters]] that are stored in this object's cache.
If the need for cache resetting is detected, calling this method will trigger the reset.
an array, containing all cached Counters.
this CachedCounters' update interval. Used to dump the cache to memory at regular intervals.
Increments the named [[CounterType.Increment Incremental Counter]] by the given value.
the name of the counter to increment.
the value to increment the counter by.
Incrementes the named [[CounterType.Increment Incremental Counter]] by 1.
the name of the counter to increment.
Checks if the component is opened.
true if the component has been opened and false otherwise.
Updates the named [[CounterType.LastValue Last Counter]] by setting its last value to the value given.
the name of the counter to update.
the value to update the counter with.
Opens the component.
(optional) transaction id to trace execution through call chain.
callback function that receives error or null no errors occured.
Saves the current counters measurements.
current counters measurements to be saves.
Sets this CachedCounters' update interval, which is used to dump the cache to memory at regular intervals.
the value to set this CachedCounters' update interval to.
Sets references to dependent components.
references to locate the component dependencies.
Adds the given value to the named [[CounterType.Statistics Statistics Counter]] and recalculates its statistics, taking into account the new value. Statistics include last, count, min, max, and average.
the name of the counter to update.
the value to update the counter with.
Updates the named [[CounterType.Timestamp Timestamp Counter's]] time to the time given.
the name of the counter to update.
the timestamp to update the counter to.
Updates the named [[CounterType.Timestamp Timestamp Counter's]] time to the current time.
the name of the counter to update.
Generated using TypeDoc
Performance counters that send their metrics to Prometheus service.
The component is normally used in passive mode conjunction with PrometheusMetricsService. Alternatively when connection parameters are set it can push metrics to Prometheus PushGateway.
Configuration parameters
References
*:logger:*:*:1.0
(optional) ILogger components to pass log messages*:counters:*:*:1.0
(optional) ICounters components to pass collected measurements*:discovery:*:*:1.0
(optional) IDiscovery services to resolve connectionRestService
CommandableHttpService
Example
let counters = new PrometheusCounters(); counters.configure(ConfigParams.fromTuples( "connection.protocol", "http", "connection.host", "localhost", "connection.port", 8080 )); counters.open("123", (err) => { ... }); counters.increment("mycomponent.mymethod.calls"); let timing = counters.beginTiming("mycomponent.mymethod.exec_time"); try { ... } finally { timing.endTiming(); } counters.dump();