cockroachdb / cockroachdb/cockroach

pkg/util/schedulerlatency: runtimeHistogram implements WindowedHistogram interface when it's not windowed

Open
#116,690 1 comment 0 reactions 0 assignees View on GitHub
A-observability-inf C-enhancement quality-friday T-observability
Dominant language
Go
Stars
32.5k
Forks
4.1k
PR merge metrics
PR metrics pending

Description

**Is your feature request related to a problem? Please describe.**
The `runtimeHistogram` [explicitly implements the WindowedHistogram interface](https://github.com/cockroachdb/cockroach/blob/master/pkg/util/schedulerlatency/histogram.go#L42), but if you look at its implementation, it uses a **cumulative** histogram when calculating things like quantiles, average, etc:

https://github.com/cockroachdb/cockroach/blob/master/pkg/util/schedulerlatency/histogram.go#L158-L161

This is incorrect and misleading behavior. These values are not windowed, and this will cause the metric to experience problems in DB Console when graphing the metric's quantiles/averages, similar to what we're seeing in the following issues:

- https://github.com/cockroachdb/cockroach/issues/112947
- https://github.com/cockroachdb/cockroach/issues/115825

**Describe the solution you'd like**
`runtimeHistogram` should support windowing, like every other histogram does, or it should not exist.

An even better option would be to find a way to get rid of it altogether in favor of consolidating the histogram implementations, as outlined in https://github.com/cockroachdb/cockroach/issues/116584

Jira issue: CRDB-34722

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.