grafana / timestream-datasource

Amazon Timestream in Grafana
https://grafana.com/grafana/plugins/grafana-timestream-datasource
Apache License 2.0
23 stars 19 forks source link

Let user configure default tables and database macros #258

Closed sarahzinger closed 7 months ago

sarahzinger commented 10 months ago

Discussed in https://github.com/grafana/timestream-datasource/discussions/204

Originally posted by **baxterjo** November 17, 2022 # Problem The title of this issue alludes to my proposed solution a bit. But I would like to provide the "why" here incase anyone has a better idea of how to implement what I am trying to do. I currently have several, identical data sources across a few AWS accounts. The names of the databases and tables in these accounts are created by an application stack deployment process and are not identical, but the data in the tables are identical. In my existing Grafana instance, I have one dashboard per data source and all of the dashboards are identical as well. The problem is that when I make a change to one dashboard, I then have to go through and make that change to all dashboards. # What I have Tried I tried making the data source a variable in the dashboard, but the macros associated with `$__table` and `$__database` in the datasource are overwritten on the left side of the query editor when editing a panel. So when I swap the data source on the environment variable dropdown menu, all of the queries break because they are looking for the wrong databases and tables. # Potential Engineering Solution When writing a query for an Amazon Timestream resource there are three Macro dropdowns on the left side of the query block. I would like to add an explicit `use_datasource_default` option to those dropdowns to allow for easy switching between datasources on the same dashboard. ### OR Create new macros for the plugin such as `$__source_default_database`, `$__source_default_table`, and `$__source_default_measure`
sarahzinger commented 10 months ago

@baxterjo I moved your discussion to an issue for our backlog! Another thing to try could be to create variables that are hard-coded table names/database names, I think that should work? Although I haven't actually tested.

Still I think it's a reasonable feature request to want a default table/default database macro

katebrenner commented 7 months ago

I hope @sarahzinger workaround worked for you! Closing as this is not on our immediate roadmap