Prometheus:如何将grafana中的历史数据显示为当前数据

Prometheus: how to show history data in grafana as current data

要求: 我想在grafana中将离线数据显示为当前数据。

示例: 我在 prometheus 中有时间戳是 7 天前的数据(从 14 天前到 7 天前)。 现在我想在 grafana 中将其显示为当前数据。从 14 天前的时间戳开始,并确保 grafana 将时间戳显示为当前时间戳。 那我该怎么做呢?

在 PromQL 查询中使用 offset

sum by (foo) (rate(counter_total{bar="zoom"}[5m] offset 7d))

https://prometheus.io/docs/prometheus/latest/querying/basics/#offset-modifier