[Feature request] Support Prometheus-compatible PromQL rate(), irate(), increase(), and delta() for range vectors
Maintainer antworten meist innerhalb von 1 Tag
@CoollZzz arbeitet bereits daran.
Seit 17.6.2026.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
Search before asking
- I searched in the issues and found nothing similar.
Motivation
Description
IoTDB should support Prometheus-compatible semantics for the PromQL rate(), irate(), increase(), and delta() functions on range vectors.
The expected behavior should follow Prometheus:
rate(v range-vector)returns the per-second average rate of increase over the selected range.irate(v range-vector)returns the per-second instant rate based on the last two samples in the selected range.increase(v range-vector)returns the total increase over the selected range.delta(v range-vector)returns the difference between the first and last values over the selected range.rate(),irate(), andincrease()should be used with counters and should handle counter resets correctly.delta()should be used with gauges and should not apply counter-reset correction.rate(),increase(), anddelta()should use all samples in the range and extrapolate to the range boundaries.irate()should use only the last two samples and should not extrapolate to range boundaries.
Expected Implementation Semantics
For rate() on float counters:
- Require at least two samples.
- Compute the raw increase as
last - first. - For each adjacent sample pair, detect counter reset when
current < previous. - For each detected reset, add the previous value to the corrected increase.
- If start timestamp metadata is available, also treat start timestamp reset as a counter reset.
- Apply Prometheus-compatible boundary extrapolation.
- Divide by the full range duration in seconds.
For increase() on float counters:
- Require at least two samples.
- Use the same counter-reset correction and boundary extrapolation logic as
rate(). - Return the extrapolated total increase over the range.
- Do not divide by the range duration.
- The result should be equivalent to
rate(v) * rangeDurationSeconds.
For irate() on float counters:
- Require at least two samples.
- Use only the last two samples in the range.
- If no reset is detected, return
(last - previous) / intervalSeconds. - If reset is detected, return
last / intervalSeconds. - Do not perform range-boundary extrapolation.
For delta() on float gauges:
- Require at least two samples.
- Compute the raw delta as
last - first. - Do not apply counter-reset correction.
- Apply Prometheus-compatible boundary extrapolation to cover the full range.
- Return the extrapolated delta directly.
- Do not divide by the range duration.
Test Cases
Please add compatibility tests for:
rate()without reset.rate()with one counter reset.rate()with multiple counter resets.rate()boundary extrapolation when samples are close to the range boundaries.rate()boundary extrapolation when samples are far from the range boundaries.rate()counter zero-point extrapolation guard.increase()without reset.increase()with one counter reset.increase()with multiple counter resets.increase()boundary extrapolation.increase()producing the same value asrate(v) * rangeDurationSeconds.irate()without reset.irate()with reset between the last two samples.irate()ignoring older samples except for selecting the last two points.delta()with increasing gauge values.delta()with decreasing gauge values.delta()boundary extrapolation.delta()not treating value decreases as counter resets.- Empty result when fewer than two samples are available.
References
- Prometheus
rate()documentation: https://prometheus.io/docs/prometheus/latest/querying/functions/#rate - Prometheus
irate()documentation: https://prometheus.io/docs/prometheus/latest/querying/functions/#irate - Prometheus
increase()documentation: https://prometheus.io/docs/prometheus/latest/querying/functions/#increase - Prometheus
delta()documentation: https://prometheus.io/docs/prometheus/latest/querying/functions/#delta - Prometheus
resets()documentation: https://prometheus.io/docs/prometheus/latest/querying/functions/#resets - Prometheus implementation: https://github.com/prometheus/prometheus/blob/main/promql/functions.go
Solution
No response
Alternatives
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!
- Vorherrschende Sprache
- Java
- Sterne
- 6.4k
- Forks
- 1.2k
- Ø Merge
- 1 T. 17 Std.
- Gemergte PRs (30 T.)
- 152
Entwicklungsumgebung
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus apache/iotdb
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
apache/iotdb#18655 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
IoTDB Edge: stop-edge.sh does not stop its own process when IOTDB_HOME is set, and reports successOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
[Bug] findColumn throws NullPointerException instead of SQLException for an unknown column nameOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
ci-failure-cause test-failure
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
nextcloud/notes-android#3367 ·
Maintainer antworten meist innerhalb von 1 Tag
-
:wave: team-triage a:chore in:isolated-projects in:kotlin-dsl
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag