Skip to content

feat(core): even-distribution histogram quantile via order-statistic interpolation - #2275

Open
sherali42 wants to merge 4 commits into
filodb:developfrom
sherali42:hist_func_2
Open

feat(core): even-distribution histogram quantile via order-statistic interpolation#2275
sherali42 wants to merge 4 commits into
filodb:developfrom
sherali42:hist_func_2

Conversation

@sherali42

Copy link
Copy Markdown
Contributor

Pull Request checklist

  • The commit(s) message(s) follows the contribution guidelines ?
  • Tests for the changes have been added (for bug fixes / features) ?
  • Docs have been added / updated (for bug fixes / features) ?

Extend Histogram.quantile's evenDistribution mode to use the order-statistic percentile convention instead of the Prometheus q*N rank:

  • rank = (N-1)*q + 1
  • reconstruct evenly-spaced samples within each bucket at j*width/(s+1) and interpolate between the two samples straddling rank; the two neighbours may live in different buckets, so interpolation can cross a bucket boundary
  • the top fractional sample snaps toward max once its index reaches the total observation count

The default (Prometheus, linear/exponential) path is unchanged. Adds a value-pinned HistogramTest covering interior, tail max-snap, and cross-bucket-boundary quantiles.

sherali42 and others added 4 commits June 1, 2026 23:42
…interpolation

Extend Histogram.quantile's evenDistribution mode to use the order-statistic
percentile convention instead of the Prometheus q*N rank:

- rank = (N-1)*q + 1
- reconstruct evenly-spaced samples within each bucket at j*width/(s+1) and
  interpolate between the two samples straddling rank; the two neighbours may
  live in different buckets, so interpolation can cross a bucket boundary
- the top fractional sample snaps toward `max` once its index reaches the
  total observation count

The default (Prometheus, linear/exponential) path is unchanged. Adds a
value-pinned HistogramTest covering interior, tail max-snap, and
cross-bucket-boundary quantiles.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant