无法从 Clickhouse 数据源在 Grafana 中绘制数据图表
Unable to Graph Data in Grafana from Clickhouse Datasource
我是 Grafana 的新手。我尝试绘制的数据以表格格式显示正常,但当我尝试使用图形进行可视化时,它显示无法绘制数据。
表格数据如下:
count() t
----------------------------
54 2020-12-02 09:00:00
387 2020-12-02 09:01:00
1462 2020-12-02 09:02:00
这是查询:
SELECT
count(),
$dateTimeCol as t
FROM $table
where date='2020-12-02'
GROUP BY t
ORDER BY t
我正在使用 Grafana/7.1.4 和 clickhouse 作为数据源。我错过了什么?
提前致谢
应该使用$timeSeries-macros:
SELECT
$timeSeries t,
count()
FROM $table
WHERE date='2020-12-02' /* should be used 'WHERE $timeFilter' ? */
GROUP BY t
ORDER BY t
让我们模拟测试数据集:
SELECT
$timeSeries as t,
count()
FROM (select (now() - rand() % 24*60*60) AS dt from $table limit 1024)
WHERE $timeFilter
GROUP BY t
ORDER BY t
定义查询参数 - FROM as system.numbers, Column:DateTime作为 dt:
对于 24 小时范围获取图表:
我是 Grafana 的新手。我尝试绘制的数据以表格格式显示正常,但当我尝试使用图形进行可视化时,它显示无法绘制数据。
表格数据如下:
count() t
----------------------------
54 2020-12-02 09:00:00
387 2020-12-02 09:01:00
1462 2020-12-02 09:02:00
这是查询:
SELECT
count(),
$dateTimeCol as t
FROM $table
where date='2020-12-02'
GROUP BY t
ORDER BY t
我正在使用 Grafana/7.1.4 和 clickhouse 作为数据源。我错过了什么?
提前致谢
应该使用$timeSeries-macros:
SELECT
$timeSeries t,
count()
FROM $table
WHERE date='2020-12-02' /* should be used 'WHERE $timeFilter' ? */
GROUP BY t
ORDER BY t
让我们模拟测试数据集:
SELECT
$timeSeries as t,
count()
FROM (select (now() - rand() % 24*60*60) AS dt from $table limit 1024)
WHERE $timeFilter
GROUP BY t
ORDER BY t
定义查询参数 - FROM as system.numbers, Column:DateTime作为 dt:
对于 24 小时范围获取图表: