-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Per-datasource cache and auth storage #812
Comments
I had some brief conversation with @dneth about this last week and trying to cache datasource info introduces some interesting problems. Knowing when datasources are updated so we can invalidate the cache is tricky. At least from the UI, if we always Save & Test, we can rely on the front end to send some kind of test request and invalidate the cache/instance when that happens. But I don't know if we can guarantee that always is the case. I think ideally Grafana would give us more state, because the way the rpc plugins are arranged, it almost forces the plugins to be stateless. But that's a lot harder to change. (That's all assuming we even store DatasourceInfo. Auth tokens are the only state we really need to cache.) |
Good catch! Yes, this is tricky right now. I think we can start with "Save and Test" approach: build special |
I was going to create an issue for creating a Test query type, but after thinking about it, I'm not sure we need it. Though I'm entirely speculating since I don't know the frontend code very well... The frontend currently submits some query to test the connection. We only need to change that to run the same query on the backend. As for expiring the auth token... We probably don't need to explicitly expire it. The cache should expire after a period of time. If the login information changes, as part of the per-datasource caching, perhaps we can hash the credentials and use that to access the cache. |
I'm working on this |
I looked at the connection test and it doesn't simply execute a query, so I was mistaken there. Anyways, connection test implementation is included with the changes in my PR ^ |
Initial work is done, but as mentioned in #808 (comment), we should store cache and auth for each particular data source, not for the package at all. So we need an object that stores information related to data source, like:
This is just an example, so maybe there's better solution.
The text was updated successfully, but these errors were encountered: