add

open override fun add(currentTime: Instant, value: Double)

Adds a new metric value using reservoir sampling (Algorithm R).

For the first DESIRED_SAMPLES values, all are stored. Afterward, each subsequent value has a DESIRED_SAMPLES / totalSamplesSeen probability of being included, with older samples having equal probability of being evicted.

Parameters

currentTime

the simulation time at which the value was recorded

value

the numeric value of the metric