首页 > 解决方案 > Grafana - unable to use unix as a timestamp? PostgreSQL

问题描述

I'm trying to set up a grafana based on PSQL data source, but I can not make grafane use UNIX timestamps for some reason. Here is a sample table, which is connected to grafana:

ticks=# select * from btc_usd limit 10;
time_stamp   |  quote  |   volume
---------------+---------+------------
1632793114709 | 42373.9 |  0.0231421
1632793114929 | 42372.2 |   0.011807
1632793115546 | 42373.9 | 0.00386025
1632793116352 | 42373.9 |  0.0011276
1632793116480 | 42372.4 |  0.0161129
1632793116513 | 42372.2 |  0.0358965
1632793116513 | 42372.2 |  0.0134995
1632793116513 | 42371.9 | 0.00990016
1632793117768 | 42373.8 | 0.00058705
1632793117808 | 42373.8 | 0.00221274

(called locally from postgres db)

And here are some queries I've tried so far in grafana:

SELECT * FROM btc_usd;

SELECT time_stamp AS "time", quote FROM btc_usd;

SELECT STR_TO_DATE(time_stamp,'%Y-%m-%d %H:%i:%s') AS 'time', quote FROM btc_usd;

No matter what I try, Grafana is throwing:

Data does not have a time field

and wont chart anything :/

Im able to display data as a table:

enter image description here

标签: postgresqlgrafana

解决方案


推荐阅读