prometheus/docs/querying
beorn7 9eafed0f79 promql: Add histogram_count and histogram_sum
This follow a simple function-based approach to access the count and
sum fields of a native Histogram. It might be more elegant to
implement “accessors” via the dot operator, as considered in the
brainstorming doc [1]. However, that would require the introduction of
a whole new concept in PromQL. For the PoC, we should be fine with the
function-based approch. Even the obvious inefficiencies (rate'ing a
whole histogram twice when we only want to rate each the count and the
sum once) could be optimized behind the scenes.

Note that the function-based approach elegantly solves the problem of
detecting counter resets in the sum of observations in the case of
negative observations. (Since the whole native Histogram is rate'd,
the counter reset is detected for the Histogram as a whole.)

We will decide later if an “accessor” approach is really needed. It
would change the example expression for average duration in
functions.md from

      histogram_sum(rate(http_request_duration_seconds[10m]))
	/
      histogram_count(rate(http_request_duration_seconds[10m]))

to

      rate(http_request_duration_seconds.sum[10m])
	/
      rate(http_request_duration_seconds.count[10m])

[1]: https://docs.google.com/document/d/1ch6ru8GKg03N02jRjYriurt-CZqUVY09evPg6yKTA1s/edit

Signed-off-by: beorn7 <beorn@grafana.com>
2022-06-28 18:16:48 +02:00
..
api.md Api docs: fix link to time durations 2022-04-11 14:12:21 +02:00
basics.md Make regex-matching docs more obvious 2022-01-14 23:18:31 +01:00
examples.md Examples: explain what the duration in brackets means (#10589) 2022-04-27 11:31:01 +02:00
functions.md promql: Add histogram_count and histogram_sum 2022-06-28 18:16:48 +02:00
index.md Import querying documentation from prometheus/docs 2017-10-26 22:36:47 +02:00
operators.md address comment 2022-02-15 22:09:17 +08:00