Skip to content

Conversation

@multani
Copy link

@multani multani commented Jun 12, 2025

Histograms are built using the default bucket definitions:

If Buckets is left as nil or set to a slice of length zero, it is replaced by default buckets.

The default buckets are DefBuckets if no buckets for a native histogram (see below) are used, otherwise the default is no buckets.

And DefBuckets is:

var DefBuckets = [][float64](https://pkg.go.dev/builtin#float64){.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10}

DefBuckets are the default Histogram buckets.

The default buckets are tailored to broadly measure the response time (in seconds) of a network service.

The timers were measuring values in milliseconds, whereas the underlying buckets are configured to store number as seconds.

I spotted the misconfiguration by checking the DNS resolution timers on our deployments: most of the timers are between 5 and 10 ms (to the last 2 buckets) and all the initial buckets are almost not used.

Changing to seconds instead of milliseconds would fill up in our case the first 2 or 3 buckets and show the higher latencies (if any) more correctly.

The timers were measuring values in milliseconds, whereas they are
configured to store number as seconds.

The default buckets for histograms are made for "second" values.
@cla-assistant
Copy link

cla-assistant bot commented Jun 12, 2025

CLA assistant check
All committers have signed the CLA.

@cla-assistant
Copy link

cla-assistant bot commented Jun 12, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@multani
Copy link
Author

multani commented Jun 12, 2025

I signed the CLA :)

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