Optional preprocessing helpers inspired by VictoriaMetrics to improve compressibility on top of Gorilla.
Functions:
- scale_floats_to_ints/2: scales list of numbers by 10^N (auto or explicit), returning {ints, N}
- delta_encode_counter/1 and delta_decode_counter/1: encode/decode monotonic counters
- monotonic_non_decreasing?/1: simple monotonic check
Summary
Functions
Decodes a delta-encoded counter series back to absolutes.
Delta-encodes a monotonic counter series. Keeps the first element as absolute and replaces subsequent elements with differences.
Detects a reasonable scale (number of decimal digits) for the given values. Uses a decimal-string approach and caps at 6.
Simple check for non-decreasing monotonicity.
Scales numeric values by 10^N to integers. If N is :auto, detect the max decimals across the list (capped at 6 to avoid float artifacts).
Types
@type scale() :: non_neg_integer() | :auto
Functions
Decodes a delta-encoded counter series back to absolutes.
Delta-encodes a monotonic counter series. Keeps the first element as absolute and replaces subsequent elements with differences.
@spec detect_scale([number()]) :: non_neg_integer()
Detects a reasonable scale (number of decimal digits) for the given values. Uses a decimal-string approach and caps at 6.
Simple check for non-decreasing monotonicity.
@spec scale_floats_to_ints([number()], scale()) :: {[integer()], non_neg_integer()}
Scales numeric values by 10^N to integers. If N is :auto, detect the max decimals across the list (capped at 6 to avoid float artifacts).