cockroachdb / cockroachdb/cockroach
metric: rework the interface of `ManualWindowedHistogram`
- 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 manual histogram currently maintains a cumulative and a windowed histogram. It requires both to be passed in its `Update` function. This is a little cumbersome of an interface to use as the user is expected to maintain both, a cumulative view as well as a windowed view of the metric.
**Describe the solution you'd like**
Ideally, the `Update` function only takes a new windowed histogram and maintains the cumulative values internally. Something like how the batch histogram in Prometheus does it. https://github.com/prometheus/client_golang/blob/3d2cf0b338e19b0eaf277496058fc77bd3add440/prometheus/go_collector_latest.go#L502
Related issues: https://github.com/cockroachdb/cockroach/issues/98266 and https://github.com/cockroachdb/cockroach/issues/98621.
Jira issue: CRDB-25370
Epic CRDB-20790
Contributor guide
Research direction
Start by locating ManualWindowedHistogram and its Update callers, then compare the intended behavior with the linked Prometheus batch histogram implementation. Done means Update accepts only a new windowed histogram while maintaining cumulative values internally, with related tests and callers updated accordingly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability-sre
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100