DownsampledInstantaneousMetricData

Downsamples instantaneous metric data using reservoir sampling.

For instantaneous metrics, this implementation maintains approximately DESIRED_SAMPLES samples using Algorithm R (standard reservoir sampling). While this is visually lossy, scatter plots are primarily used to identify general patterns. Every sample has an equal probability of being preserved, providing uniform and unbiased sampling across the entire time series.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
data class Sample(val sequenceId: Long, val time: Instant, val value: Double) : Comparable<DownsampledInstantaneousMetricData.Sample>

A single metric sample at a specific point in time.

Properties

Link copied to clipboard
open override val values: PersistentList<MetricValue>

All metric values stored in this data object, in chronological order.

Functions

Link copied to clipboard
open override fun add(currentTime: Instant, value: Double)

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