Skip to content

Commit 5febf8e

Browse files
committed
revert unwanted change(already explain elsewhere)
Signed-off-by: discord9 <[email protected]>
1 parent 1812d70 commit 5febf8e

File tree

1 file changed

+0
-47
lines changed

1 file changed

+0
-47
lines changed

docs/user-guide/flow-computation/manage-flow.md

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -221,53 +221,6 @@ please refer to [`date_bin`](/reference/sql/functions/df-functions.md#date_bin).
221221
Currently, flow rely on the time window expr to determine how to incrementally update the result. So it's better to use a relatively small time window when possible.
222222
:::
223223

224-
### Write a PromQL query
225-
226-
GreptimeDB Flow also supports using PromQL for continuous aggregation, allowing you to leverage familiar PromQL syntax for time-series analysis. When writing PromQL queries for Flow, it's crucial to specify an `eval interval` as PromQL doesn't have a fixed time window. This interval determines how frequently the PromQL query is evaluated and new aggregated results are generated.
227-
228-
For example, to calculate the 1-minute rate of `http_requests_total` for a specific job, you might use a PromQL query like this:
229-
230-
```promql
231-
rate(http_requests_total{job="my_service"}[1m])
232-
```
233-
234-
Here's a full example of using TQL (PromQL with `EVAL` clause) within a Flow:
235-
236-
```sql
237-
CREATE TABLE http_requests_total (
238-
host STRING,
239-
job STRING,
240-
instance STRING,
241-
byte DOUBLE,
242-
ts TIMESTAMP TIME INDEX
243-
);
244-
245-
CREATE TABLE prom_aggregated (
246-
host STRING,
247-
job STRING,
248-
instance STRING,
249-
value DOUBLE,
250-
timestamp TIMESTAMP TIME INDEX,
251-
);
252-
253-
CREATE FLOW calc_rate
254-
SINK TO rate_reqs
255-
EVAL INTERVAL '1m' AS
256-
TQL EVAL (now() - '1m'::interval, now(), '30s') rate(http_requests_total{job="my_service"}[1m]);
257-
```
258-
259-
In this example:
260-
- `prom_metrics` is the source table where raw Prometheus-style metrics are ingested.
261-
- `prom_aggregated` is the sink table that will store the continuously aggregated results.
262-
- `TQL EVAL (start, end, '1m')` indicates that the PromQL query `rate(http_requests_total{job="my_service"}[1m])` is evaluated with a `step` of 1 minute.
263-
- The `rate` function calculates the per-second average rate of increase of the `http_requests_total` metric over the last 1 minutes.
264-
- The results, including the calculated `value` and the `timestamp` (which corresponds to the evaluation timestamp), are then written to the `rate_reqs` sink table.
265-
266-
This setup allows you to perform continuous, real-time PromQL-based aggregations on your time-series data, making it readily available for dashboards, alerts, and further analysis.
267-
268-
In the context of Flow, this query would be evaluated every `eval interval` (e.g., every 1 minute, 5 minutes, etc.), and the results would be continuously updated in your sink table. The `eval interval` ensures that the aggregation is performed at regular, defined periods, which is essential for consistent time-series analysis and efficient resource utilization. Without a specified `eval interval`, the Flow engine would not know how often to re-evaluate the PromQL expression, leading to undefined behavior or inefficient processing.
269-
270-
271224
## Flush a flow
272225

273226
The flow engine automatically processes aggregation operations within a short period(i.e. few seconds) when new data arrives in the source table.

0 commit comments

Comments
 (0)