Skip to content

MetricCalculationHandler

MetricCalculationHandler = (event) => number | null

Computes the numeric value one Event contributes to a Metric.

AlpyneEvent

Event being projected.

number | null

The Event’s value, or null to exclude it.

Without a handler every Event contributes 1, so the Metric counts its Events. A handler can return another number, such as a duration or an amount carried in the payload, or null to leave the Event out of the projection.

MetricBuilder.addEvent