Files
greptimedb/promql/histogram_eval/index.html
T

28 lines
12 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Histogram functions over evaluated series: `histogram_quantile` and `histogram_fraction` over classic and native histograms (Prometheus `funcHistogramQuantile`, `funcHistogramFraction` and `resetHistograms`), and `histogram_count`, `histogram_sum`, `histogram_avg`, `histogram_stddev` and `histogram_stdvar` over native histograms."><title>promql::histogram_eval - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-1ed95124.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="promql" data-themes="" data-resource-suffix="" data-rustdoc-version="1.98.1 (48a229cea 2026-09-01)" data-channel="1.98.1" data-search-js="search-9944d736.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../../static.files/storage-41dd4d93.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-417ebf0a.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module histogram_eval</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../promql/index.html">promql</a><span class="version">1.4.0-alpha.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module histogram_<wbr>eval</a></h2><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#functions" title="Functions">Functions</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate promql</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">promql</a></div><h1>Module <span>histogram_<wbr>eval</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/promql/histogram_eval.rs.html#15-418">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Histogram functions over evaluated series: <code>histogram_quantile</code> and <code>histogram_fraction</code> over
classic and native histograms (Prometheus <code>funcHistogramQuantile</code>, <code>funcHistogramFraction</code>
and <code>resetHistograms</code>), and <code>histogram_count</code>, <code>histogram_sum</code>, <code>histogram_avg</code>,
<code>histogram_stddev</code> and <code>histogram_stdvar</code> over native histograms.</p>
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="aggregate/index.html" title="mod promql::histogram_eval::aggregate">aggregate</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>The compensated <code>sum</code> and <code>avg</code> fold of native histograms, following the histogram paths of
Prometheus <code>aggregation</code>. The range functions <code>sum_over_time</code> and <code>avg_over_time</code> fold a window
with it, and the aggregate node runs the same steps per point through
<code>crate::aggregate::HistogramAccumulator</code>.</dd><dt><a class="mod" href="bounds/index.html" title="mod promql::histogram_eval::bounds">bounds</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Prometheus <code>exponentialBounds</code> (<code>model/histogram/generic.go</code>): the bucket bounds in [0.5, 1)
of exponential schemas 0 to 8, which <code>getBoundExponential</code> scales by a power of two.</dd><dt><a class="mod" href="classic/index.html" title="mod promql::histogram_eval::classic">classic</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Prometheus <code>BucketQuantile</code> and <code>BucketFraction</code> over the buckets of a classic histogram at
one point.</dd><dt><a class="mod" href="float_histogram/index.html" title="mod promql::histogram_eval::float_histogram">float_<wbr>histogram</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Arithmetic on owned native histograms, following Prometheus <code>FloatHistogram</code>
(<code>model/histogram/float_histogram.go</code>): <code>Add</code>, <code>KahanAdd</code>, <code>Sub</code>, <code>Mul</code>, <code>Div</code>, <code>Compact</code>,
<code>CopyToSchema</code>, <code>DetectReset</code> and <code>Equals</code>, including zero bucket reconciliation, resolution
reduction and the intersection of mismatched custom bounds.</dd><dt><a class="mod" href="legacy_bridge/index.html" title="mod promql::histogram_eval::legacy_bridge">legacy_<wbr>bridge</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Legacy [<code>NativeHistogram</code>] quantile, fraction and arithmetic, evaluated by the native kernel
so both paths share one implementation of Prometheus’s histogram rules. Each function reads
the histogram through a [<code>HistogramView</code>] and returns results in the legacy UDFs’ shape.</dd><dt><a class="mod" href="native/index.html" title="mod promql::histogram_eval::native">native</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Prometheus <code>HistogramQuantile</code>, <code>HistogramFraction</code> and the <code>histogramVariance</code> estimate over
one native histogram, with the bucket iteration of <code>model/histogram</code>.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.Group.html" title="struct promql::histogram_eval::Group">Group</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>The series of one label set (<code>le</code> aside): classic buckets, and the series of exactly that
label set when it holds native histograms.</dd><dt><a class="struct" href="struct.HistogramParameters.html" title="struct promql::histogram_eval::HistogramParameters">Histogram<wbr>Parameters</a></dt><dd>Per-grid-point arguments to a classic or native histogram function.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.HistogramFunction.html" title="enum promql::histogram_eval::HistogramFunction">Histogram<wbr>Function</a></dt><dd><code>histogram_quantile</code> or <code>histogram_fraction</code> with its constant arguments.</dd><dt><a class="enum" href="enum.NativeHistogramFunction.html" title="enum promql::histogram_eval::NativeHistogramFunction">Native<wbr>Histogram<wbr>Function</a></dt><dd>A function of one native histogram.</dd></dl><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.BUCKET_LABEL.html" title="constant promql::histogram_eval::BUCKET_LABEL">BUCKET_<wbr>LABEL</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="constant" href="constant.HISTOGRAM_ROUTING_EXCLUDED_LABELS.html" title="constant promql::histogram_eval::HISTOGRAM_ROUTING_EXCLUDED_LABELS">HISTOGRAM_<wbr>ROUTING_<wbr>EXCLUDED_<wbr>LABELS</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Labels left out of the routing key, so histogram inputs that can produce the same output meet
at one partition. The kernel still groups by the metadata labels before dropping them; <code>le</code> is
removed before grouping.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.evaluate_histograms.html" title="fn promql::histogram_eval::evaluate_histograms">evaluate_<wbr>histograms</a></dt><dd>Evaluates <code>function</code> over the classic and native histograms in <code>series</code>.</dd><dt><a class="fn" href="fn.evaluate_histograms_with_annotations.html" title="fn promql::histogram_eval::evaluate_histograms_with_annotations">evaluate_<wbr>histograms_<wbr>with_<wbr>annotations</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Evaluates <code>function</code> with optional per-point scalar arguments, reporting what it drops to
<code>collector</code>. A missing parameter value suppresses the output at that point, matching aggregate
quantile’s missing-q behavior.</dd><dt><a class="fn" href="fn.grid_axis.html" title="fn promql::histogram_eval::grid_axis">grid_<wbr>axis</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Errors unless <code>series</code> is on a grid axis.</dd><dt><a class="fn" href="fn.has_histograms.html" title="fn promql::histogram_eval::has_histograms">has_<wbr>histograms</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.histogram_quantiles.html" title="fn promql::histogram_eval::histogram_quantiles">histogram_<wbr>quantiles</a></dt><dd><code>histogram_quantiles(v, label, q...)</code>: <a href="fn.evaluate_histograms.html" title="fn promql::histogram_eval::evaluate_histograms"><code>evaluate_histograms</code></a> with <code>Quantile(q)</code> for each
<code>q</code>, each result labelled with <code>label</code> set to <code>q</code> as Prometheus’ <code>FormatOpenMetricsFloat</code>
writes it. Results that then share a label set merge as <a href="../grid_series/fn.merge_same_labelset.html" title="fn promql::grid_series::merge_same_labelset"><code>merge_same_labelset</code></a> does, so a
repeated <code>q</code>, or a <code>label</code> that overwrites the label telling two histograms apart, fails at a
point both hold. Each <code>q</code> is a constant; a per-step quantile is not supported here.</dd><dt><a class="fn" href="fn.histogram_string.html" title="fn promql::histogram_eval::histogram_string">histogram_<wbr>string</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>A native histogram as Go’s <code>FloatHistogram.String</code> writes it, the label value <code>count_values</code>
gives a histogram sample.</dd><dt><a class="fn" href="fn.map_native_histogram.html" title="fn promql::histogram_eval::map_native_histogram">map_<wbr>native_<wbr>histogram</a></dt><dd>Applies <code>function</code> to the native histogram samples of <code>series</code>; float samples are dropped and
so is <code>__name__</code>. <code>None</code> when the series has no histogram sample. Series that share a label
set once their names are dropped must then go through <a href="../grid_series/fn.merge_same_labelset.html" title="fn promql::grid_series::merge_same_labelset"><code>merge_same_labelset</code></a>.</dd></dl></section></div></main></body></html>