Add values to a rolling window and retrieve percentile calculations such as median, 90th, 99th, etc.
The underlying data structure contains a circular array of buckets that "roll" over time.
For example, if the time window is configured to 60 seconds with 12 buckets of 5 seconds each, values will be captured in each 5 second bucket and rotate each 5 seconds.
This means that percentile calculations are for the "rolling window" of 55-60 seconds up to 5 seconds ago.
Each bucket will contain a circular array of long values and if more than the configured amount (1000 values for example) it will wrap around and overwrite values until time passes and a new bucket is allocated. This sampling approach for high volume metrics is done to conserve memory and reduce sorting time when calculating percentiles.