-
What Grafana version and what operating system are you using?
v6.5.2
-
What are you trying to achieve?
Visualizing mutest tests count information segregated by each individual using guage panel
-
How are you trying to achieve it?
- I have test cases information in a table called public.muted_tests saved in postgres database.
- When am trying to build the query to pull metrics over time series, am getting error in grafana.
Here is the query:
SELECT
$__timeGroupAlias("timestamp",$__interval),
mutedtestcounts
FROM muted_tests
WHERE
$__timeFilter("timestamp")
GROUP BY 1
ORDER BY 1
here is the generated sql what is shows:
SELECT
time_bucket('1200s',"timestamp") AS "time",
mutedtestcounts
FROM muted_tests
WHERE
"timestamp" BETWEEN '2021-07-06T18:04:34.761Z' AND '2021-08-05T18:04:34.761Z'
GROUP BY 1
ORDER BY 1
And here is the error what i get to see:
pq: function time_bucket(unknown, timestamp without time zone) does not exist
Hi @pavannayakanti ,
do you have TimescaleDB installed? Becase timebucket is TimescaleDB function.
You have 2 options:
- Install TimescaleDB using https://docs.timescale.com/timescaledb/latest/how-to-guides/install-timescaledb/
- Or use PG
date_trunc function
Regards,
Sergejs
Thanks for these inputs.
I have been using postgres db to save this time series information. This is what my db consists of
bitbucketdb_dev=# select timestamp, userid, mutedtestscount from muted_tests limit 10;
timestamp | userid | mutedtestscount
---------------------+--------+-----------------
2021-08-05 06:54:00 | abc123 | 1
2021-08-05 06:54:00 | abc123 | 1
2021-08-05 06:54:00 | def456 | 1
2021-08-05 06:54:00 | abc123 | 1
2021-08-05 06:54:00 | abc123 | 2
2021-08-05 06:54:00 | abc123 | 1
2021-08-05 06:54:00 | koz963 | 1
2021-08-05 06:54:00 | koz963 | 1
2021-08-05 06:54:00 | abc123 | 1
And am using the same datasource in grafana for visualizations. Am not sure if there is any way i can insist grafana to use data_trunc instead of data_bucket.

by any chance, is my choice of opting to postgresql incorrect for my requirement?
please advise.
What happens if you ran that generated query in pg