Interface

IMetricListener

IMetricListener

A simple interface for listening for Metric updates. Should be plugged into something like Prometheus for recording. Metric names are defined in metric_names.ts - see documentation on the name for what the context object contains. All metrics have a context object, with applicable interface. See the IMetricContext interface for more information.

View Source metrics/IMetricListener.ts, line 5

Members

void

# onEndMetric

Called when the given metric should stop being tracked. Will have started with a matching onStartMetric() call.

View Source metrics/IMetricListener.ts, line 24

void

# onStartMetric

Called when the given metric should start being tracked. Will be paired with a matching onEndMetric() call.

View Source metrics/IMetricListener.ts, line 16

Methods

# onDecrement(metricName, context, amount)

Called when a linear metric (increasing/decreasing number) should be decremented.
Parameters:
Name Type Description
metricName string The metric being called.
context IMetricContext Context for the metric. Never null.
amount number The amount to subtract. Never negative or zero.

View Source metrics/IMetricListener.ts, line 44

# onIncrement(metricName, context, amount)

Called when a linear metric (increasing/decreasing number) should be incremented.
Parameters:
Name Type Description
metricName string The metric being called.
context IMetricContext Context for the metric. Never null.
amount number The amount to add. Never negative or zero.

View Source metrics/IMetricListener.ts, line 34

# onReset(metricName, context)

Called when a linear metric (increasing/decreasing number) should be reset to zero.
Parameters:
Name Type Description
metricName string The metric being called.
context IMetricContext Context for the metric. Never null.

View Source metrics/IMetricListener.ts, line 54