trinodb / grafana-trino

The Trino datasource allows to query and visualize Trino data from within Grafana.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add data source fail!

vinson-zhang opened this issue · comments

image
when I use the same address in DBeaver, it can work well!

Which version (commit) are you using? Can you try pulling the latest main branch?

Also, when reporting errors, please provide as much detail as possible. I can't figure out what's wrong with a single error message. Most often project maintainers would have to be able to reproduce the bug in an isolated environment. In a case like this, you should provide:

  • what kind of authentication you're using
  • if you're connecting using TLS
  • logs from both Grafana and Trino
  1. the config in DBeaver , it can work well!
  • IP:xxx.xxx.xxx.xxx
  • port:8520
  • database: hive
  • username: xxx
  • password is null
  1. the config in grafan:
  • URL: http://xxxx:8520
  • Auth config:basic auth is open and others is close
  • Basic Auth Details: user : xxxx
  • Basic Auth Details: password is null

image

  1. the fail request in chrome, when click save&test button in grafana:
Request URL: http://localhost:3000/api/ds/query
Request Method: POST
Status Code: 500 Internal Server Error
Remote Address: [::1]:3000
Referrer Policy: strict-origin-when-cross-origin
{"from":"5m","to":"now","queries":[{"refId":"A","key":"A","intervalMs":1,"maxDataPoints":1,"datasource":{"type":"trino-datasource","uid":"5jG9AHX7k"},"rawSQL":"SELECT 1","format":0}]}

Response:
{"message":"Query data error","traceID":"00000000000000000000000000000000"}
  1. the log in grafan container:
logger=context traceID=00000000000000000000000000000000 userId=1 orgId=1 uname=admin t=2022-05-16T07:37:27.16+0000 lvl=eror msg="Request Completed" method=POST path=/api/ds/query status=500 remote_addr=172.17.0.1 time_ms=0 duration=791.5µs size=75 referer=http://localhost:3000/datasources/edit/5jG9AHX7k traceID=00000000000000000000000000000000
  1. I can't find any log in trino

Thanks! It looks like the backend plugin crashes since Grafana responds with a 500 error. To see the exact reason, you'd have to enable debug logs by setting GF_LOG_LEVEL=debug environment variable in the Grafana backend.

I have fixed a number of issues since last week. Can you try the latest master? I'll be crafting proper releases and filling up the change log once the plugin gets approved by Grafana and I'll be able to sign it.

logger=datasources t=2022-05-16T08:46:03.83+0000 lvl=dbug msg="Received command to update data source" url=http://106.75.84.150:8520
logger=datasource t=2022-05-16T08:46:03.83+0000 lvl=dbug msg="Applying default URL parsing for this data source type" type=trino-datasource url=http://106.75.84.150:8520
logger=datasources t=2022-05-16T08:46:03.98+0000 lvl=dbug msg="Querying for data source via SQL store" uid=K4uasHunz orgId=1
logger=query_data t=2022-05-16T08:46:03.98+0000 lvl=dbug msg="Processing metrics query" query="unsupported value type"
logger=context traceID=00000000000000000000000000000000 userId=1 orgId=1 uname=admin t=2022-05-16T08:46:03.98+0000 lvl=eror msg="Query data error" error="plugin unavailable" remote_addr=172.17.0.1 traceID=00000000000000000000000000000000
logger=context traceID=00000000000000000000000000000000 userId=1 orgId=1 uname=admin t=2022-05-16T08:46:03.98+0000 lvl=eror msg="Request Completed" method=POST path=/api/ds/query status=500 remote_addr=172.17.0.1 time_ms=0 duration=634.4µs size=75 referer=http://localhost:3000/datasources/edit/K4uasHunz traceID=00000000000000000000000000000000

What version of Grafana are you running? The plugin is tested with the latest, that is 8.5.1

Can you show logs from the Grafana backend after it's started? Maybe it failed to load the plugin. In the logs you included there's a:

lvl=eror msg="Query data error" error="plugin unavailable"

ok. Here are the exceptions I found:
And I am using win10 and docker. the grafana is running in docker.


logger=plugin.loader t=2022-05-16T09:27:52.05+0000 lvl=dbug msg="Loading plugin" path=/var/lib/grafana/plugins/trino/grafana-trino/dist/plugin.json

logger=plugin.loader t=2022-05-16T09:27:52.07+0000 lvl=dbug msg="Plugin is unsigned" id=trino-datasource

logger=plugin.signature.validator t=2022-05-16T09:27:52.07+0000 lvl=warn msg="Permitting unsigned plugin. This is not recommended" pluginID=trino-datasource pluginDir=/var/lib/grafana/plugins/trino/grafana-trino/dist

logger=plugin.manager t=2022-05-16T09:27:52.07+0000 lvl=info msg="Plugin registered" pluginId=trino-datasource

logger=plugin.trino-datasource t=2022-05-16T09:27:52.07+0000 lvl=dbug msg="starting plugin" path=/var/lib/grafana/plugins/trino/grafana-trino/dist/gpx_Trino_linux_amd64 args="unsupported value type"

logger=plugin.manager t=2022-05-16T09:27:52.07+0000 lvl=eror msg="Could not start plugin" pluginId=trino-datasource err="fork/exec /var/lib/grafana/plugins/trino/grafana-trino/dist/gpx_Trino_linux_amd64: no such file or directory"

Looks like the backend plugin was not built. Did you run mage in the plugin directory?

Finally, it can query normally. Thank you very much! Maybe the MAGE execution failed earlier and I didn't notice