kumulant

QuantileFilterStat

class QuantileFilterStat(val probability: Double = 0.99, val relativeError: Double = 0.01, val concurrency: Concurrency = Concurrency.None) : SeriesStat<QuantileFilterResult> (source)

Streaming quantile-threshold anomaly detector. Tracks the input distribution via a DDSketchStat and exposes the q-quantile as a threshold; the result's score(x) helper flags x > threshold as a binary anomaly.

The threshold adapts with the stream: as new observations arrive, the quantile drifts, so the same input value may flip between anomalous and normal as the distribution shifts. Use QuantileFilterStat when you want a non-parametric alternative to GaussianScorerStat (no Gaussianity assumption) or when the metric of interest is "is x in the tail of what we've seen?".

Memory: O(1 / relativeError); backed by a single-probability DDSketch.

Update: O(1) per observation (one striped bin increment).

Concurrency: Inherits DDSketchStat's additive-mode striped counters; lock-free under every Concurrency level.

Constructors

Link copied to clipboard
constructor(probability: Double = 0.99, relativeError: Double = 0.01, concurrency: Concurrency = Concurrency.None)

Properties

Link copied to clipboard
open override val concurrency: Concurrency

The thread-safety contract this stat was constructed with. Each stat picks the cell-encoding and lock strategy that honours this contract for its mathematical structure:

Link copied to clipboard

Probability in (0, 1) at which the threshold is evaluated.

Link copied to clipboard

Relative-error guarantee passed to the underlying DDSketch.

Functions

Link copied to clipboard
open override fun create(concurrency: Concurrency? = null): QuantileFilterStat

Spawn a fresh accumulator with the same configuration. Optionally override the Concurrency; useful for materialising a wire spec at a different concurrency level than the source.

Link copied to clipboard
open override fun merge(values: QuantileFilterResult): Nothing

Merge is unsupported: QuantileFilterResult only carries the threshold scalar, not the underlying DDSketch bin layout, so two snapshots cannot be combined into a faithful joint distribution. Anomaly detectors are not typically sharded across streams; if you need a distributed quantile, merge a DDSketchStat directly and project here.

Link copied to clipboard
open override fun read(timestampNanos: Long = currentTimeNanos()): QuantileFilterResult

Materialise the current state as an immutable Result. Reads never mutate, so the caller can read as often as it likes without affecting the stream.

Link copied to clipboard
open override fun reset()

Reset the stat to its prior-seeded baseline. Equivalent to constructing a fresh stat with the same configuration, but in place; keeps the same Concurrency and any per-stat tunables.

Link copied to clipboard
open fun update(value: Double, weight: Double = 1.0)

Record an observation with the given weight, stamped at the current time.

open override fun update(value: Double, timestampNanos: Long, weight: Double = 1.0)

Record an observation at timestampNanos with the given weight. Stats that consume time (rates, decay, windowing) use this as the ordering signal; pass a monotonic stamp when feeding from a replay log.

QuantileFilterStat

constructor(probability: Double = 0.99, relativeError: Double = 0.01, concurrency: Concurrency = Concurrency.None)(source)

concurrency

open override val concurrency: Concurrency(source)

The thread-safety contract this stat was constructed with. Each stat picks the cell-encoding and lock strategy that honours this contract for its mathematical structure:

Picked at construction; immutable after.

create

open override fun create(concurrency: Concurrency? = null): QuantileFilterStat(source)

Spawn a fresh accumulator with the same configuration. Optionally override the Concurrency; useful for materialising a wire spec at a different concurrency level than the source.

The returned stat is independent: its state starts at the configured baseline, not at the source's current state. Each modality subtype narrows the return type so chaining doesn't lose the modality.

merge

open override fun merge(values: QuantileFilterResult): Nothing(source)

Merge is unsupported: QuantileFilterResult only carries the threshold scalar, not the underlying DDSketch bin layout, so two snapshots cannot be combined into a faithful joint distribution. Anomaly detectors are not typically sharded across streams; if you need a distributed quantile, merge a DDSketchStat directly and project here.

probability

Probability in (0, 1) at which the threshold is evaluated.

read

open override fun read(timestampNanos: Long = currentTimeNanos()): QuantileFilterResult(source)

Materialise the current state as an immutable Result. Reads never mutate, so the caller can read as often as it likes without affecting the stream.

Snapshot consistency depends on the configured Concurrency. Under Concurrency.Strict / Concurrency.HighWrite a read locks against writers so coupled cells stay consistent. Under Concurrency.Relaxed the cells race and the snapshot may drift by ULPs of the workload under heavy contention; the drift is bounded and the read never throws.

timestampNanos is the read timestamp. Stats that don't care about time silently drop it; stats that do (rates, decay families, recency, windowed wrappers) use it as the ordering signal.

relativeError

Relative-error guarantee passed to the underlying DDSketch.

reset

open override fun reset()(source)

Reset the stat to its prior-seeded baseline. Equivalent to constructing a fresh stat with the same configuration, but in place; keeps the same Concurrency and any per-stat tunables.

update

open override fun update(value: Double, timestampNanos: Long, weight: Double = 1.0)(source)

Record an observation at timestampNanos with the given weight. Stats that consume time (rates, decay, windowing) use this as the ordering signal; pass a monotonic stamp when feeding from a replay log.