Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Feature request] Support Prometheus-compatible PromQL rate(), irate(), increase(), and delta() for range vectors

オープン
#17,976 コメント 1 件 リアクション 0 件 担当者 1 名 GitHub で見る

@CoollZzz がすでに取り組んでいます。

2026年6月17日 から。

評価

この issue はまだ評価されていません。

説明

good-first-issue New Feature
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(), and increase() 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(), and delta() 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:

  1. Require at least two samples.
  2. Compute the raw increase as last - first.
  3. For each adjacent sample pair, detect counter reset when current < previous.
  4. For each detected reset, add the previous value to the corrected increase.
  5. If start timestamp metadata is available, also treat start timestamp reset as a counter reset.
  6. Apply Prometheus-compatible boundary extrapolation.
  7. Divide by the full range duration in seconds.

For increase() on float counters:

  1. Require at least two samples.
  2. Use the same counter-reset correction and boundary extrapolation logic as rate().
  3. Return the extrapolated total increase over the range.
  4. Do not divide by the range duration.
  5. The result should be equivalent to rate(v) * rangeDurationSeconds.

For irate() on float counters:

  1. Require at least two samples.
  2. Use only the last two samples in the range.
  3. If no reset is detected, return (last - previous) / intervalSeconds.
  4. If reset is detected, return last / intervalSeconds.
  5. Do not perform range-boundary extrapolation.

For delta() on float gauges:

  1. Require at least two samples.
  2. Compute the raw delta as last - first.
  3. Do not apply counter-reset correction.
  4. Apply Prometheus-compatible boundary extrapolation to cover the full range.
  5. Return the extrapolated delta directly.
  6. 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 as rate(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

Solution

No response

Alternatives

No response

Are you willing to submit a PR?
  • I'm willing to submit a PR!
主要言語
Java
スター
6.4k
フォーク
1.2k
平均マージ
1日 17時間
マージ済み PR(30日)
152

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/iotdb のほかの issue

apache/iotdb の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。