grafana-aws-athena-datasource icon indicating copy to clipboard operation
grafana-aws-athena-datasource copied to clipboard

limited plugin functionality

Open pmattens opened this issue 4 years ago • 3 comments

Does the plugin only allow retrieving results based on a query execution id? I am not able to use the plugin to do anything else.

pmattens avatar Apr 03 '20 13:04 pmattens

You can use Templates (Now renamed to Variables) to get a list of run commands based on the query string. That's what this means: https://github.com/mtanda/grafana-aws-athena-datasource#query-variable

image

You can use a query like that to return the latest execution and then reference the variable in your query like this: image

Kitsune-Fox avatar Apr 20 '20 17:04 Kitsune-Fox

I want to get the results of the latest execution of a named query, so I can basically even modify queries in Athena and re-run daily, but dont need to modify the Grafana dashboard. This seems to be the only way to use this that makes sense to me. Individual query IDs are nice for testing, but make no sense in a dashboard that needs data updated eventually.

I tried to do this:

  • Get all Saved/Names queries as Variable $Name (named_query_names) -> works and can I can pick in drop down
  • Get the SQL of the query with the filter $Name as new variable $Query (named_query_queries)-> works and I can see the SQL
  • Now get the Execution ID by using the pattern $Query in the new variable $ID (query_execution_ids) -> this seems not to work anymore, but I think it should. It might be Grafana having a difficulty to evaluate the subsequent usage of variables. If I just use "select" as pattern it works eventually, after reloading and waiting for a while.

I think there should be a way to specify the name of a query and get the ID, ideally even allow to select the name of the query (which I have in $Name) and then use $Name somehow in the graph as query to get the data, or to translate in ID.

pdunk avatar Jun 05 '20 22:06 pdunk

Hmm, I'm not sure you can do what you need, unfortunately the only way to filter the Athena events is by using some of the statement that is within the query. So if this is your query: SELECT ColA, ColB FROM "DataBase"."TableName" limit 10;

You can use "TableName" as the filter. So far I cant seem to get it to work with more than a few words, so 'SELECT *' works as a filter but 'SELECT * FROM' doesn't. You cant put '' or "" around the query either, so it's pretty messed up.

What I do is that I have a table name for each thing I need to return and I use that table name as the query param in Grafana. query_execution_ids(eu-west-X,1,TableName,GrafanaMetrics)

I then have a Lambda that triggers the Athena query on a trigger.

This plugin is highly unreliable and will most likely give you this the whole time: Template variables could not be initialized: ThrottlingException: Rate exceeded status code: 400, request id: xxxx

If I knew Go I'd give fixing it up a bit a try, but that's way above my head.

Edit: Looks like it understands 'SELECT *' as being on a different line than the 'FROM table'

Kitsune-Fox avatar Jun 08 '20 14:06 Kitsune-Fox