Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics: add H2 Histogram option to improve histogram granularity #6897

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rcoh
Copy link
Contributor

@rcoh rcoh commented Oct 10, 2024

Motivation

#6896

Solution

This PR introduces a configurable new histogram for the poll-time histogram based on H2 Histograms. As part of this, three APIs are deprecated:

  • metrics_poll_count_histogram_scale
  • metrics_poll_count_histogram_resolution
  • metrics_poll_count_histogram_buckets

Since I suspect these are commonly used, I thought it was worth a little added complexity to provide a graceful path to removing them.

They are replaced with metrics_poll_count_histogram_configuration that accepts a histogram configuration object. The intention of this change is to provide more knobs when configuring histograms (as customers will want with the H2 histogram).

The default histogram remains the linear histogram with 10 buckets. The default H2 histogram provides a 25% error bound from 100ns to 60s of poll time and uses about 1KB of storage. This is configurable by customers as well.

The h2_histogram code is fairly complex compared to the code for the other histogram modes, so I isolated it into its own module. I brought back proptest to test invariants across a wide range of possible parameters–since there isn't any actual branching in this code, we don't get any value from making them fuzz tests (other than that they are a little more annoying to run).

@Darksonn Darksonn added A-tokio Area: The main tokio crate M-tracing Tracing support in Tokio labels Oct 11, 2024
@Darksonn Darksonn requested a review from hds October 11, 2024 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tokio Area: The main tokio crate M-tracing Tracing support in Tokio
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants