I am using Grafana version 6.5.0 and I have installed “Presto plugin” to connect to Trino (Note that since the Grafana version I am using is 6, I cannot use the Trino plugin because it requires Grafana version 8 and above.)
presto plugin link: https://github.com/sabarishs/presto-grafana
I have installed the plugin from the above link and when I want to add a data source as shown in the image below, I encounter an error:
HTTP Error Bad Gateway
When I put “Access” on the browser, I don’t encounter any errors, but when I use this data source in the dashboard and query Trino, no data is displayed in the output.
hi @mikhailvolkov, I did the same thing and installed the Trino plugin on Grafana 9, but the problem is that the performance of my dashboard that directly queries Trino is deficient, for example, it takes at least 40 minutes for a time range of 7 days. is there a solution that improves the performance of this particular dashboard
I need to correct the information I gave you:
When I run a query in Trino without a where clause, it takes a lot of time, with a where clause it takes a few seconds. Similarly, when I run a query without any where clause in Grafana, it seems that regardless of the time range, it loads all the data from the trino first, then in the panel, it shows the data of the desired time range, that’s why it takes a long time, but when I use the clause “where DATE_KEY between 20230829 and 20230904” in the query panel, the loading time of the panel is greatly reduced. But the problem is that this expression is fixed and I want the user to decide what data to see in the panel by selecting the time in the time range.
So grafana is not taking longer than trino. they are pretty comparable.
Now on to your where clause issue. Your DATE_KEY column is numeric or integer data type column? If so in order for the query to be dynamic you will need to convert the _from and _to date ranges to be same format as DATE_KEY using one of the following date functions.
Yes, the type of the DATE_KEY column is numeric, and in order to use the time series, I use the “Convert Field Type” transformation and first change the type to string, then to time. Honestly, I didn’t understand your advice, can you explain more?
you want to use the selected time in your WHERE clause right? And the DATE_KEY column is numeric.
You cant use the time ranges because they are not numeric. you need to convert them to numeric
I’m just looking for a solution to load my dashboard My dashboard is impacting everything…if I convert the time range to a numeric, I can’t use the time series visualization anymore, I want to display the trend of the data on the dashboard, so is it not possible I use special macros?
I used $__dateFilter(DATE_KEY) but I get an error
I tried to use your suggested solution but I am facing the following error.
declare @from = CAST(date_format(TIMESTAMP __from, ‘%Y-%m-%d’) as integer);
declare @to = CAST(date_format(TIMESTAMP __to, ‘%Y-%m-%d’) AS integer);
SELECT * FROM kimchi
WHERE DATE_KEY between @from and @to
GROUP BY DATE_KEY