telemetry_metrics_prometheus_core icon indicating copy to clipboard operation
telemetry_metrics_prometheus_core copied to clipboard

Using the same default buckets as other libraries

Open isaacsanders opened this issue 3 years ago • 1 comments
trafficstars

Hey all,

I would like to suggest that we use a default value for our buckets that other libraries use.

Python

https://github.com/prometheus/client_python/blob/5a5261dd45d65914b5e3d8225b94d6e0578882f3/prometheus_client/metrics.py#L544

DEFAULT_BUCKETS = (.005, .01, .025, .05, .075, .1, .25, .5, .75, 1.0, 2.5, 5.0, 7.5, 10.0, INF)

Golang

https://github.com/prometheus/client_golang/blob/66837e3298bdc57a828794c23bacb253ed8c04cd/prometheus/histogram.go#L68

DefBuckets = []float64{.005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10}

Java

https://github.com/prometheus/client_java/blob/6ae0c961cfc19b8ef0575c98ac82ee55b11002ed/simpleclient/src/main/java/io/prometheus/client/Histogram.java#L88

private double[] buckets = new double[] { .005, .01, .025, .05, .075, .1, .25, .5, .75, 1, 2.5, 5, 7.5, 10 };

Overlap

Value Duration Python Golang Java
0.005 5ms Yes Yes Yes
0.01 10ms Yes Yes Yes
0.025 25ms Yes Yes Yes
0.05 50ms Yes Yes Yes
0.075 75ms Yes No Yes
0.1 100ms Yes Yes Yes
0.25 250ms Yes Yes Yes
0.5 500ms Yes Yes Yes
0.75 750ms Yes No Yes
1.0 1s Yes Yes Yes
2.5 2.5s Yes Yes Yes
5.0 5s Yes Yes Yes
7.5 7.5s Yes No Yes
10.0 10s Yes Yes Yes

isaacsanders avatar Jun 14 '22 15:06 isaacsanders

I think that's fine if you want to do a PR

bryannaegele avatar Jun 14 '22 16:06 bryannaegele