Command builders for Redis t-digest (TDIGEST.*) operations.
A t-digest is a compact data structure for estimating percentiles and quantiles from streaming or distributed data. It works by maintaining a sorted set of centroids that adaptively merge as data arrives, providing high accuracy at the tails of the distribution (e.g. p99, p99.9) where it matters most. Typical use cases include latency monitoring, SLA tracking, and any scenario where you need to answer "what value is at the Nth percentile?" without storing every observation.
All functions in this module are pure and return a command list (a list of
strings) suitable for passing to Redis.command/2 or Redis.pipeline/2.
Examples
# Create a t-digest and add observations
Redis.pipeline(conn, [
TDigest.create("latency"),
TDigest.add("latency", [1.2, 3.4, 5.6, 7.8, 100.0])
])
# Query the 50th and 99th percentiles
Redis.command(conn, TDigest.quantile("latency", [0.5, 0.99]))
Summary
Functions
Adds one or more numeric observations to the t-digest sketch.
Creates an empty t-digest sketch. Pass compression: n to control the
trade-off between accuracy and memory (higher = more accurate, default 100).
Estimates the value at each given quantile (0.0 to 1.0). For example,
quantile(key, [0.5, 0.99]) returns the estimated median and p99 values.
Functions
Adds one or more numeric observations to the t-digest sketch.
@spec byrank(String.t(), [non_neg_integer()]) :: [String.t()]
@spec byrevrank(String.t(), [non_neg_integer()]) :: [String.t()]
Creates an empty t-digest sketch. Pass compression: n to control the
trade-off between accuracy and memory (higher = more accurate, default 100).
Estimates the value at each given quantile (0.0 to 1.0). For example,
quantile(key, [0.5, 0.99]) returns the estimated median and p99 values.