Documentation

prometheus.histogramQuantile() function

Flux 0.51.0+

The prometheus.histogramQuantile() function is experimental and subject to change at any time. By using this function, you accept the risks of experimental functions.

The prometheus.histogramQuantile() function calculates quantiles on a set of values assuming the given histogram data is scraped or read from a Prometheus data source. prometheus.histogramQuantile() is an aggregate function.

import "experimental/prometheus"

prometheus.histogramQuantile(
  quantile: 0.99,
  metricVersion: 2
)

Parameters

quantile

A value between 0.0 and 1.0 indicating the desired quantile.

metricVersion

Prometheus metric parsing format used to parse queried Prometheus data. Available versions are 1 and 2. Default is 2.

tables

Input data. Default is piped-forward data (<-).

Examples

Compute the 0.99 quantile of a Prometheus histogram

import "experimental/prometheus"

prometheus.scrape(url: "http://localhost:8086/metrics")
    |> filter(fn: (r) => r._measurement == "prometheus")
    |> filter(fn: (r) => r._field == "qc_all_duration_seconds")
    |> prometheus.histogramQuantile(quantile: 0.99)

Compute the 0.99 quantile of a Prometheus histogram parsed with metric version 1

import "experimental/prometheus"

from(bucket: "example-bucket")
    |> range(start: -1h)
    |> filter(fn: (r) => r._measurement == "qc_all_duration_seconds")
    |> prometheus.histogramQuantile(quantile: 0.99, metricVersion: 1)

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.