1. There should be an inf bucket otherwise there might be entries that don't 
appear in any, but are included in the count.

2. You can have other labels like any other metric, for example by status.

3 & 4. Label and row ordering doesn't really matter.

What language are you using, as many of the client libraries have support for 
histograms which sorts all this out for you? 

On 10 April 2020 12:49:55 BST, "Damian Kamiński" <[email protected]> wrote:
>Hi,
>
>I'm writing Prometheus client library and while trying to figure out
>how to 
>expose histograms I found out that documentation is not really clear. 
>
>Docs: 
>https://prometheus.io/docs/instrumenting/exposition_formats/#text-format-example
>
>Example shown there is the most basic one:
>
># A histogram, which has a pretty complex representation in the text
>format:
># HELP http_request_duration_seconds A histogram of the request
>duration.
># TYPE http_request_duration_seconds histogram
>http_request_duration_seconds_bucket{le="0.05"} 24054
>http_request_duration_seconds_bucket{le="0.1"} 33444
>http_request_duration_seconds_bucket{le="0.2"} 100392
>http_request_duration_seconds_bucket{le="0.5"} 129389
>http_request_duration_seconds_bucket{le="1"} 133988
>http_request_duration_seconds_bucket{le="+Inf"} 144320
>http_request_duration_seconds_sum 53423
>http_request_duration_seconds_count 144320
>
>
>My questions are:
>1. +Inf must be last? Or is it just a convention?
>2. How about labels? "le" is the only allowed label or can there be
>more?
>3. If there can be more labels then how about order of buckets?
>4. "le" should be first or last label?
>
>Is below example ok (everything ordered alphabetically so +Inf is a
>first 
>bucket, additional label added)?
>
># TYPE latency_seconds histogram
>latency_seconds_bucket{upstream="bar",le="+Inf"} 123
>latency_seconds_bucket{upstream="bar",le="0.001"} 1
>latency_seconds_bucket{upstream="bar",le="0.002"} 5
>latency_seconds_bucket{upstream="bar",le="0.003"} 6
>latency_seconds_bucket{upstream="foo",le="+Inf"} 234
>latency_seconds_bucket{upstream="foo",le="0.001"} 1
>latency_seconds_bucket{upstream="foo",le="0.002"} 4
>latency_seconds_bucket{upstream="foo",le="0.003"} 5
>latency_seconds_count{upstream="bar"} 123
>latency_seconds_count{upstream="foo"} 234
>latency_seconds_sum{upstream="bar"} 5
>latency_seconds_sum{upstream="foo"} 8
>
>
>-- 
>You received this message because you are subscribed to the Google
>Groups "Prometheus Users" group.
>To unsubscribe from this group and stop receiving emails from it, send
>an email to [email protected].
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/prometheus-users/149642f6-9682-4ed2-a32f-651bfa9a24b2%40googlegroups.com.

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/84A0EEE2-162C-410E-93B9-0AE72D9318C5%40Jahingo.com.

Reply via email to