Closed njvrzm closed 9 months ago
As it turns out, while this works, it's unnecessarily deep - the problem is actually with how some aws datasources respond to the NewDatasource
call from the manager (thanks @gabor for the help figuring this out!). Closing this one.
An issue was created for
athena-datasource
(https://github.com/grafana/athena-datasource/issues/264) where if you rotate AWS credentials and then edit them in the datasource config in grafana, the new credentails aren't used until the datasource is recreated (or the server restarted). This is because database connections there are cached based only on the datasource UID and (if present) the connection arguments.The
grafana-aws-sdk
uses a cache mechanism copied from sqlds, and the same issue is present in all sqlds-based (and awsds-based) datasources as well. To address this I've updated sqlds to include theUpdated
timestamp from the datasource settings in its cache key, and to expose the key mechanism soathena
can use it instead of duplicated code.This does, unfortunately, slightly change the
sqlds
API - theGetDBFromQuery
method now takesbackend.DataSourceInstanceSettings
instead of astring
for the datasource UID. However, as far as I can tell (searching github and google both) this method is only used ingrafana-aws-sdk
, in one place. Personally I think it's probably okay to keep this atv3
despite the API change, but please let me know if you think we need to bump to v4 instead.