trinodb / grafana-trino Goto Github PK
View Code? Open in Web Editor NEWThe Trino datasource allows to query and visualize Trino data from within Grafana.
License: Apache License 2.0
The Trino datasource allows to query and visualize Trino data from within Grafana.
License: Apache License 2.0
Hi, can I use trino plugin to acess data that requires kerberos authentication? At first glance it rather wont work, bu tmaybe i missed something?
The first- and last- buckets in date histograms are often incomplete. Rather than showing artificially-low values near the edges (which look like steep declines in whatever metric is aggregated), it'd be nice to optionally "trim" N buckets off the ends. The ES data source allows this in its Date Histogram with the "Trim Edges" option.
For my current use-case, I can get away with AND date(field) < date(NOW() - INTERVAL '1' day)
, but the option would be extra snazzy.
This is required so that the Save & Test
button actually verifies the connection. Without this, users have a false impression that everything is ok, even if they haven't entered the URL!
I succeeded in setting up grafana:9.4.7 with the grafana-trino-plugin and got some basic dashboard workin.
But when trying to create a query based variable I don't see a text box to enter a query.
This is unfortunately the first plugin I'm using, and I am quite confused as to how to use it.
After running the docker command:
docker run -d -p 3000:3000 \
-v "$(pwd):/var/lib/grafana/plugins/trino" \
-e "GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=trino-datasource" \
--name=grafana \
grafana/grafana-oss
I do not see Trino in the plugins or as an available data source when I visit localhost:3000. What am I doing wrong?
Grafana docker container and Trino running as service on the docker host
If I try to configure the URL for Trino as Data source with localhost (assuming I have trino running locally), I get the following error trace:
An unexpected error happened
Details
TypeError: t.toLowerCase is not a functionat xt (http://localhost:3000/public/build/Connections.608bdba8a44d08800970.js:83:805) at form at Nt (http://localhost:3000/public/build/Connections.608bdba8a44d08800970.js:83:1909) at me (http://localhost:3000/public/build/Connections.608bdba8a44d08800970.js:83:1460) at i (http://localhost:3000/public/build/226.bf42e9a5216532a30776.js:457:703) at div at div at div at div at Z (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:137:79781) at r (http://localhost:3000/public/build/226.bf42e9a5216532a30776.js:61:29995) at div at A (http://localhost:3000/public/build/226.bf42e9a5216532a30776.js:457:4386) at Lt (http://localhost:3000/public/build/Connections.608bdba8a44d08800970.js:83:5444) at Oe (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:203:23560) at Oe (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:203:25756) at zt (http://localhost:3000/public/build/Connections.608bdba8a44d08800970.js:91:2067) at Suspense at o (http://localhost:3000/public/build/226.bf42e9a5216532a30776.js:61:118536) at Tf (http://localhost:3000/public/build/226.bf42e9a5216532a30776.js:4855:330) at Oe (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:203:23560) at Ki (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:194:4727) at yt (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:194:10218) at bu (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:203:11747) at Oe (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:203:25756) at div at div at main at div at bi (http://localhost:3000/public/build/226.bf42e9a5216532a30776.js:4852:2396) at Ki (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:194:4727) at yt (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:194:10218) at Xe (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:194:9607) at Zu (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:203:12046) at Oe (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:203:19731) at div at l (http://localhost:3000/public/build/226.bf42e9a5216532a30776.js:81:13223) at p (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:37:13807) at h (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:615:177459) at i (http://localhost:3000/public/build/226.bf42e9a5216532a30776.js:781:19710) at o (http://localhost:3000/public/build/226.bf42e9a5216532a30776.js:61:118536) at g (http://localhost:3000/public/build/226.bf42e9a5216532a30776.js:61:119045) at E (http://localhost:3000/public/build/1486.9f5c58b5413b0650af69.js:172:118307) at Af (http://localhost:3000/public/build/226.bf42e9a5216532a30776.js:4866:122)
This is a completely misleading error message, because TypeError: t.toLowerCase is not a function gives no information about the real problem. The same happens with 127.0.0.1.
Steps to reproduce:
default: 10.1.4
docker run -d -p 3000:3000 --name=grafana
-e "GF_INSTALL_PLUGINS=trino-datasource"
grafana/grafana-oss
Add a new Trino Data source in grafana (type: Trino) with URL: http://localhost:8080/
Solution:
I need to get the IP address of the docker host, so that I can refer it inside the docker container.
For Mac/Windows, use the special DNS name: host.docker.internal instead of the 127.0.0.1 or localhost in your URL string.
I tried running a query like this:
select date_trunc('day', created_at), count(*) as num_issues from hive.v2.issues group by 1 order by 1
and got:
Data is missing a number field
after checking the query inspector, it turned out that the count is recognized as a string, not an integer.
Figure out how to create automated tests, unit, and integration (running against an actual Trino server).
Hi folks, we are using the plugin in Grafana, but the latest version ( 1.0.5
) is not working.
When we click to run the query, for example, nothing is running.
Doing an initial debug, it seems that the query editor is not updating with the new query we wrote.
It may be related to this change.
The last version ( 1.0.4
) is working however with the problem described in the commented issue, updating at all times.
Grafana version: 9.5.13
For queries that run a bit longer (> 1 second) there's no feedback in the UI that the user needs to wait.
Hi @nineinchnick ,
I noticed that if I use explore tab and write some queries, each time I change the browser tab a new query is triggered . How can I avoid this behaviour , like only have query triggered if and only if RunQuery is clicked
Hello Everyone,
Some context
As a user of Starburst, we need to be able to impersonate Grafana's connected users to execute request on Starburst.
Because we apply access policies with Ranger on Starburst and want to be able to apply the right access of the user who is connected to Grafana.
We don't want to use a generic service account, as we can't figure who exactly perform the request, and we need that information for two reasons:
For now, the user configured on the Grafana's Data Source configuration is the one which perform the request on Starburst.
So, what we are looking for:
Some search on what could be done (maybe) to achieve that
Unfortunately, I don't have suffisiant knowlegde to make the dev myself for this. That's why I come here...
But here the things I think are needed to be done/implemented (even if I don't know exactly where):
impersonationNeeded: Boolean;
connectedUser: String;
constructor(....) {
this.impersonationNeeded = instanceSettings.jsonData.impersonationNeeded || false;
this.connectedUser = instanceSettings.username;
}
Then maybe a possibility to pass connected user to each Trino request::
doRequest(options: any) {
options.headers = options.headers || {};
// Add the impersonation header if set
if (this.impersonationNeeded) {
options.headers['X-Trino-User'] = this.connectedUser;
}
return this.backendSrv.datasourceRequest[...];
}
But does this header option be transferred to the Trino client when calling request, I don't know ?
Another possibility, is maybe adding this option in the Trino client in Go directly when executing a request:
https://github.com/trinodb/trino-go-client/blob/60351ff4fb2c3a2c1e67ea660ee37d286b2aeb15/README.md#system-access-control-and-per-query-user-information
db.Query("SELECT * FROM foobar WHERE id=?", 1, sql.Named("X-Trino-User", string(<connectedUser>)))
But I don't see how to pass to the Trino GO Client instance....
I think this feature can useful for many Trino user.
Can someone know how to do that ?
Thanks,
Eric
logger=plugin.loader t=2023-04-26T22:53:08.891392795Z level=error msg="Could not start plugin" pluginId=trino-datasource err="fork/exec /var/lib/grafana/plugins/trino/dist/gpx_Trino_linux_amd64: no such file or directory"
logger=context userId=1 orgId=1 uname=admin t=2023-04-26T22:53:14.584423212Z level=error msg="Internal server error" error="[plugin.unavailable] plugin unavailable" remote_addr=10.2.119.135 traceID=
logger=context userId=1 orgId=1 uname=admin t=2023-04-26T22:53:14.584497601Z level=error msg="Request Completed" method=POST path=/api/ds/query status=500 remote_addr=10.2.119.135 time_ms=2 du
My trino queries take about a minute to complete.
Every time I load the Trino dashboard, click to a different dashboard and back to the Trino dashboard, the queries are run again, which is really slow and a bad user experience. I think instead, the old data should be cached and displayed while the data is being loaded.
This seems to be an option for other data sources:
https://grafana.com/blog/2021/09/02/reduce-costs-and-increase-performance-with-query-caching-in-grafana-cloud/
Trino folder is showing inside the /var/lib/grafana/plugin, while adding datasource getting 404 error.
Below is my Dockerfile
FROM grafana/grafana-oss:latest
COPY . /var/lib/grafana/plugins/trino
ENV GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=trino-datasource
EXPOSE 3000
VOLUME /var/lib/grafana/plugins/trino
I tried follwing the steps in grafana/loki#6168 but not able to get the context of installing yarn.
Can you please help?
Hi, thank you for developing this plugin. I have tested it locally in Docker environment, and it worked perfectly. May I check if you have any plan to publish this plugin on Grafana Plugins so that more users can discover and use this plugin?
logger=plugin.loader t=2023-02-08T05:59:45.25603939Z level=error msg="Could not start plugin" pluginId=trino-datasource err="fork/exec /var/lib/grafana/plugins/trino/src/gpx_Trino_linux_amd64: no such file or directory"
Where is this file gpx_Trino_linux_amd64?
When I try to add a Trino datasource, Grafana UI tells me "An error occurred within the plugin" and I see this stack trace in the grafana-server.exe terminal (with GF_LOG_LEVEL=debug). I removed the timestamp and logging level to make it more readable.
level=info msg="Loading Trino data source settings"
msg="panic: runtime error: invalid memory address or nil pointer dereference"
msg="[signal 0xc0000005 code=0x0 addr=0x18 pc=0x128da22]"
msg=
msg="goroutine 15 [running]:"
msg="github.com/trinodb/grafana-trino/pkg/trino/driver.Open({0xc0000f0510, {0xc0006540a0, 0xc0003d23c0, 0x0, 0x0, 0x0, 0xc00064bce0, 0xc00064bda0, 0xc00064bd40, {0x0, ...}, ...}})"
msg="\t/home/runner/work/grafana-trino/grafana-trino/pkg/trino/driver/driver.go:27 +0x62"
msg="github.com/trinodb/grafana-trino/pkg/trino.(*TrinoDatasource).Connect(0xc00043e5a0, {0x7, {0xc000656030, 0x24}, {0xc000052270, 0x10}, {0xc000052340, 0x5}, {0xc0003c8040, 0x3c}, ...}, ...)"
msg="\t/home/runner/work/grafana-trino/grafana-trino/pkg/trino/datasource.go:50 +0xdf"
msg="github.com/grafana/sqlds/v2.(*SQLDatasource).NewDatasource(0xc0004ad9a0, {0x7, {0xc000656030, 0x24}, {0xc000052270, 0x10}, {0xc000052340, 0x5}, {0xc0003c8040, 0x3c}, ...})"
msg="\t/home/runner/go/pkg/mod/github.com/grafana/sqlds/[email protected]/datasource.go:84 +0x7f"
msg="github.com/grafana/grafana-plugin-sdk-go/backend/datasource.(*instanceProvider).NewInstance(0xc0004ee3d8?, {0x1, {0xc000052270, 0x10}, 0xc0006489c0, 0x0, 0xc0003d8780})"
msg="\t/home/runner/go/pkg/mod/github.com/grafana/[email protected]/backend/datasource/instance_provider.go:58 +0xd5"
msg="github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt.(*instanceManager).Get(0xc0004ee3c0, {0x1, {0xc000052270, 0x10}, 0xc0006489c0, 0x0, 0xc0003d8780})"
msg="\t/home/runner/go/pkg/mod/github.com/grafana/[email protected]/backend/instancemgmt/instance_manager.go:114 +0x595"
msg="github.com/grafana/grafana-plugin-sdk-go/internal/automanagement.(*Manager).QueryData(0x165fbe8?, {0x165fbe8, 0xc00064bcb0}, 0xc0003c75e0)"
msg="\t/home/runner/go/pkg/mod/github.com/grafana/[email protected]/internal/automanagement/manager.go:28 +0x82"
msg="github.com/grafana/grafana-plugin-sdk-go/backend.(*dataSDKAdapter).QueryData(0xc000116020, {0x165fbe8, 0xc00064baa0}, 0x0?)"
msg="\t/home/runner/go/pkg/mod/github.com/grafana/[email protected]/backend/data_adapter.go:49 +0x7d"
msg="github.com/grafana/grafana-plugin-sdk-go/backend/grpcplugin.(*dataGRPCServer).QueryData(0xf98013?, {0x165fbe8?, 0xc00064baa0?}, 0xc00064ba70?)"
msg="\t/home/runner/go/pkg/mod/github.com/grafana/[email protected]/backend/grpcplugin/grpc_data.go:47 +0x2b"
msg="github.com/grafana/grafana-plugin-sdk-go/genproto/pluginv2._Data_QueryData_Handler.func1({0x165fbe8, 0xc00064baa0}, {0x1421c00?, 0xc0003c60f0})"
msg="\t/home/runner/go/pkg/mod/github.com/grafana/[email protected]/genproto/pluginv2/backend_grpc.pb.go:195 +0x78"
msg="github.com/grpc-ecosystem/go-grpc-prometheus.(*ServerMetrics).UnaryServerInterceptor.func1({0x165fbe8, 0xc00064baa0}, {0x1421c00, 0xc0003c60f0}, 0xc0005bd628?, 0xc0003cc858)"
msg="\t/home/runner/go/pkg/mod/github.com/grpc-ecosystem/[email protected]/server_metrics.go:107 +0x87"
msg="github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func2.1({0x165fbe8?, 0xc00064baa0?}, {0x1421c00?, 0xc0003c60f0?})"
msg="\t/home/runner/go/pkg/mod/github.com/grpc-ecosystem/[email protected]/chain.go:48 +0x4f"
msg="go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc.UnaryServerInterceptor.func1({0x165fbe8, 0xc00064a1e0}, {0x1421c00, 0xc0003c60f0}, 0xc0003d2360, 0xc000648740)"
msg="\t/home/runner/go/pkg/mod/go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/[email protected]/interceptor.go:344 +0x528"
msg="github.com/grpc-ecosystem/go-grpc-middleware.ChainUnaryServer.func2({0x165fbe8, 0xc00064a1e0}, {0x1421c00, 0xc0003c60f0}, 0xc0003d2360, 0x1373b60?)"
msg="\t/home/runner/go/pkg/mod/github.com/grpc-ecosystem/[email protected]/chain.go:53 +0x14e"
msg="github.com/grafana/grafana-plugin-sdk-go/genproto/pluginv2._Data_QueryData_Handler({0x1353200?, 0xc0001163d0}, {0x165fbe8, 0xc00064a1e0}, 0xc0000e4070, 0xc00010c3c0)"
msg="\t/home/runner/go/pkg/mod/github.com/grafana/[email protected]/genproto/pluginv2/backend_grpc.pb.go:197 +0x138"
msg="google.golang.org/grpc.(*Server).processUnaryRPC(0xc000138000, {0x1666fb8, 0xc0001041a0}, 0xc0000c8360, 0xc00010cab0, 0x1dd9790, 0x0)"
msg="\t/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1337 +0xdf3"
msg="google.golang.org/grpc.(*Server).handleStream(0xc000138000, {0x1666fb8, 0xc0001041a0}, 0xc0000c8360, 0x0)"
msg="\t/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:1714 +0xa36"
msg=google.golang.org/grpc.(*Server).serveStreams.func1.1()
msg="\t/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:959 +0x98"
msg="created by google.golang.org/grpc.(*Server).serveStreams.func1"
msg="\t/home/runner/go/pkg/mod/google.golang.org/[email protected]/server.go:957 +0x18c"
logger=context userId=1 orgId=1 uname=adminlevel=error msg="Internal server error" error="[plugin.downstreamError] failed to query data: Failed to query data: rpc error: code = Unavailable desc = error reading from server: read tcp 127.0.0.1:55604->127.0.0.1:10000: wsarecv: An existing connection was forcibly closed by the remote host." remote_addr=[::1] traceID=
logger=context userId=1 orgId=1 uname=admin level=error msg="Request Completed" method=POST path=/api/ds/query status=500 remote_addr=[::1] time_ms=11 duration=11.2691ms size=116 referer=http://localhost:3000/connections/your-connections/datasources/edit/a141f150-d2b4-4751-9d56-f7419d7352e2 handler=/api/ds/query
msg="plugin process exited" path="C:\\Program Files\\GrafanaLabs\\grafana\\data\\plugins\\trino-datasource/gpx_Trino_windows_amd64.exe" pid=8396 error="exit status 2"
msg="Restarting plugin"
Enable forwarding OAuth tokens and handle them in the backend to pass them into the driver.
Hi,
we are using Trino 428 with the official Trino datasource provided by Grafana in version 1.0.6
We have set some Dashboard variables in Grafana, e.g. variable1
. However, using them in a Query they do not seem to be replaced.
A sample Query like the following
SELECT
*
FROM
table
WHERE
$__timefilter(datetime) AND
column1 = $variable1
Fails with (line no. won't match, above example)
error querying the database: trino: query failed (200 OK): "io.trino.sql.parser.ParsingException: line 11:19: mismatched input '$'. Expecting: 'ALL', 'ANY', 'SOME', <expression>"
The query actually sent to trino looks like the following.
SELECT
*
FROM
table
WHERE
datetime BETWEEN TIMESTAMP '2024-02-01 13:00:00' AND TIMESTAMP '2024-02-01 13:59:59' AND
column1 = $variable1
The timefilter Macro seems to be applied correctly, while the dashboard variable does not get replaced.
We have contacted the Support by Grafana, they said the problem was within the trino plugin as using other datasources the variables are interpolated correctly.
After starting the Grafana with Grafana-trino plugins:
I don't understand why but, please help me to check this. Appreciate it!
I just installed yarn version v1.22.19 and downloaded this plugin. When I tried to "yarn install or build" I get this error.
Any help appreciated.
Regards,
The README should be focused on users, not developers. For devs, we might add a DEVELOPER.md
file.
Trino datasources in Grafana intermittently return the following error in dashboard panels. Sometimes the queries execute and the panel renders successfully, and other times it throws this error
error querying the database: trino: json: cannot unmarshal string into Go struct field stmtStats.stats.progressPercentage of type float32
Additionally, the same query works 100% of the time using Grafana Explore, or by querying the trino database directly.
I reached out to Grafana support with this error and they said it is likely an issue in the trino plugin itself.
I believe this may be an issue with the Trino community plugin itself based on the error provided. This error commonly occurs when the JSON data being parsed doesn't match the expected format. In this case, it looks like the Trino go client, which is used by the Trino community plugin, is expecting a float32 type and is getting a string for the ProgressPercentage field, https://github.com/trinodb/trino-go-client/blob/master/trino/trino.go#L722.
when i use this new plugin as your post here (https://github.com/starburstdata/grafana-trino/releases/download/v1.0.0-beta.1/trino-datasource.zip), i got a error when add a trino-datasource.
the error is : "this.getRef is not a function"
see the error picture as i attached.
Grafana version: 8.2.4
Look forward to your help...
@nineinchnick are there any plans to support alerting? . Can you share changes we need to make this feature available
Thanks,
Time: 11.617 s, estimated 33 s > 18 | <InlineSegmentGroup> | ^^^^^^^^^^^^^^^^^^ 19 | <div className="gf-form-group"> 20 | <h6>Frames</h6> 21 | <FormatSelect × Build failed error Command failed with exit code 1.
On the Grafana datasources page for Trino, I see options on UI to add TLS certs but when I add them, it doesn't authenticate successfully. Is MTLS authentication supported or are those UI fields for which the functionality is yet to be implemented?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.