Refresh of webpage required for Trino query panels to load data

  • What Grafana version and what operating system are you using?
    v9.4.3

  • What are you trying to achieve?
    What: Panels with Trino queries do not currently load on first browser load, it requires a browser refresh.

  • How are you trying to achieve it?
    I don’t know enough about the grafana code base to suggest a fix at this point in time.

  • What happened?
    Panels with Trino queries do not currently load on first browser load, it requires a browser refresh.

  • What did you expect to happen?
    Panels with Trino queries should load data on initial web page load

  • Can you copy/paste the configuration(s) that you are having problems with?
    The trino plugin + trino query within a panel

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    The error on first browser load is the following: "error querying the database: trino: query failed (200 OK): “io.trino.spi.TrinoException: Error reading metrics”. This goes away with a webpage refresh

  • Did you follow any online instructions? If so, what is the URL?
    I have not been able to find this issue or a fix for it online. I have checked with the trino dev community directly and they were unable to suggest a fix

That is an odd message

200 OK

The HTTP 200 OK success status response code indicates that the request has succeeded. A 200 response is cacheable by default.

Looks like the query succeeded? Can you check in both grafana logs and trino logs to see what the issue might be?

Is it possible to query trino db directly and by pass the plugin?

Agreed that the error message is a bit odd. Implies that it should have worked and then it doesn’t actually work.

I build all of my Trino queries with DBeaver right now and then paste them into the grafana browser afterwards. The dbeaver queries seem to work fine on the first run (assuming the query is written correctly).

As far as logs go, its not much (note that this is a locally hosted grafana container and i pulled these from the k8s pod that its running in):

  • logger=cleanup t=2023-06-06T04:08:10.604510582Z level=info msg=“Completed cleanup jobs” duration=58.916615ms

  • logger=context userId=1 orgId=1 uname=**** t=2023-06-06T04:09:44.548093671Z level=info msg=“Request Completed” method=GET path=/api/live/ws status=-1 remote_addr=x.x.x.x time_ms=35 dur ││_

  • logger=context userId=1 orgId=1 uname=***** t=2023-06-06T04:09:56.035279742Z level=info msg=“Request Completed” method=POST path=/api/ds/query status=400 remote_addr=x.x.x.x time_ms=102 ││/

I have zero knowledge of trino but architecture wise I found this read interesting

https://trino.io/docs/current/installation/query-resiliency.html

Where is trino installed in relation to grafana?

What dat ranges and volume of data are you bringing back from trino?

Can you share network usage stats from your browser?

Thanks for the share!

Where is trino installed in relation to grafana? Trino is installed like any other plugin, we haven’t added anything special to it.

What dat ranges and volume of data are you bringing back from trino? Right now, its not a lot but let me see if i can measure exactly how much and will get back to you.

Can you share network usage stats from your browser? Here’s a screenshot of the network tab


image

Trino the database not trino the plugin :smile:

my bad, misunderstood the question. It’s actually a prometheus database that’s managed by our internal plateng team but its hosted in a data center in the same building as the resources its connected to. Anything specific that you’d need to know about it?

1 Like

Networking and is it mono or cluster and is it using shared storage and yadi yada, things that might affect performance and then trino gets tripped up. More for your team to look into than for me

Those 10 seconds queries are worrisome. Missing indices on db etc?

CREATE TABLE example_schema.scientists (
  recordkey VARCHAR,
  name VARCHAR,
  age BIGINT,
  birthday DATE
)
WITH (
  serializer = 'string',
  index_columns='name,age,birthday'  --like the following here
);
1 Like

Can you share some queries and filters used on them sort orders used etc?

probably there’s a more efficient way of writing this query

indeed there is.
But first thing first: do you have indexes on all of those filtered columns?