Skip to content

Commit 472bd39

Browse files
committed
Improve histogram documentation
Signed-off-by: beorn7 <[email protected]>
1 parent 4a68a11 commit 472bd39

File tree

1 file changed

+39
-4
lines changed

1 file changed

+39
-4
lines changed

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@ Example input from stdin:
8282
Note that all numbers are encoded as strings. Some parsers want it
8383
that way. Also, Prometheus allows sample values like `NaN` or `+Inf`,
8484
which cannot be encoded as JSON numbers.
85-
Native histograms are formated similarly as [the query
86-
API](https://prometheus.io/docs/prometheus/latest/querying/api/#native-histograms)
87-
would return.
85+
86+
A histogram is formatted as a native histogram if it has at least one span. It
87+
is then formatted in a similar way as [the Prometehus query
88+
API](https://prometheus.io/docs/prometheus/latest/querying/api/#native-histograms)
89+
does it.
8890

8991
```json
9092
[
@@ -136,7 +138,7 @@ would return.
136138
{
137139
"name": "http_request_duration_seconds",
138140
"type": "HISTOGRAM",
139-
"help": "More HTTP request latencies in seconds.",
141+
"help": "This is a native histogram.",
140142
"metrics": [
141143
{
142144
"labels": {
@@ -166,6 +168,39 @@ would return.
166168
"sum": "29969.50000000001"
167169
}
168170
]
171+
},
172+
{
173+
"name": "some_weird_normal_distribution",
174+
"type": "HISTOGRAM",
175+
"help": "This is a classic histogram.",
176+
"metrics": [
177+
{
178+
"buckets": {
179+
"-0.0001899999999999998": "17",
180+
"-0.0002899999999999998": "6",
181+
"-0.0003899999999999998": "2",
182+
"-0.0004899999999999998": "2",
183+
"-0.0005899999999999998": "0",
184+
"-0.0006899999999999999": "0",
185+
"-0.0007899999999999999": "0",
186+
"-0.00089": "0",
187+
"-0.00099": "0",
188+
"-8.999999999999979e-05": "33",
189+
"0.00011000000000000022": "75",
190+
"0.00021000000000000023": "92",
191+
"0.0003100000000000002": "100",
192+
"0.0004100000000000002": "103",
193+
"0.0005100000000000003": "105",
194+
"0.0006100000000000003": "106",
195+
"0.0007100000000000003": "107",
196+
"0.0008100000000000004": "107",
197+
"0.0009100000000000004": "107",
198+
"1.0000000000000216e-05": "50"
199+
},
200+
"count": "107",
201+
"sum": "0.001792103516591124"
202+
}
203+
]
169204
}
170205
]
171206
```

0 commit comments

Comments
 (0)