Skip to content

goodhistogram: add ValuesAtQuantiles and common Params presets#3

Merged
angles-n-daemons merged 1 commit intomainfrom
bdillmann/quantile-batch-presets
Apr 29, 2026
Merged

goodhistogram: add ValuesAtQuantiles and common Params presets#3
angles-n-daemons merged 1 commit intomainfrom
bdillmann/quantile-batch-presets

Conversation

@angles-n-daemons
Copy link
Copy Markdown
Contributor

@angles-n-daemons angles-n-daemons commented Apr 20, 2026

Summary

Computing p50/p90/p99/p999 with individual ValueAtQuantile calls redundantly walks the bucket array and recomputes boundary densities for each quantile. ValuesAtQuantiles resolves all requested quantiles in a single pass: it sorts them by rank, computes boundary densities once, and processes each quantile as the walk reaches its bucket.

Also adds common Params presets modeled after CockroachDB's histogram_buckets.go tiers, so callers don't need to research appropriate ranges for standard measurement scenarios:

  • HiResLatencyParams (1us - 5m) — full-range request latency
  • IOLatencyParams (10us - 10s) — RPC, disk I/O
  • ResponseTimeParams (1ms - 30s) — SQL, HTTP
  • LongRunningParams (500ms - 1h) — backups, migrations
  • DataSizeParams (1KB - 16MB) — payloads
  • MemoryUsageParams (1B - 64MB) — allocations

Computing p50/p90/p99/p999 with individual ValueAtQuantile calls
redundantly walks the bucket array and recomputes boundary densities
for each quantile. ValuesAtQuantiles resolves all requested quantiles
in a single pass: it sorts them by rank, computes boundary densities
once, and processes each quantile as the walk reaches its bucket.

Also adds common Params presets (HiResLatency, IOLatency, ResponseTime,
LongRunning, DataSize, MemoryUsage) modeled after CockroachDB's
histogram_buckets.go tiers, so callers don't need to research
appropriate ranges for standard measurement scenarios.

Co-Authored-By: roachdev-claude <roachdev-claude-bot@cockroachlabs.com>
@angles-n-daemons angles-n-daemons force-pushed the bdillmann/quantile-batch-presets branch from 17ed27e to be7dbe1 Compare April 20, 2026 18:28
@jasonlmfong jasonlmfong self-requested a review April 27, 2026 14:36
Copy link
Copy Markdown
Member

@jasonlmfong jasonlmfong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, no issues

@angles-n-daemons angles-n-daemons merged commit 80c0752 into main Apr 29, 2026
3 checks passed
@angles-n-daemons angles-n-daemons deleted the bdillmann/quantile-batch-presets branch April 29, 2026 14:29
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.

2 participants