Open samuelallan72 opened 3 months ago
Did not apply this patch directly, but I tried /charm/bin/pebble restart grafana
, and it will force refresh the dashboards.
Note that we should take a second pass sometime to optimise calls to grafana_restart()
, to avoid it being restarted too many times. This will need more investigation of the code to move calls around so that it is only restarted once when necessary, and we don't miss places where it should be restarted.
Hi @samuelallan72, thank you for your contribution! There seems to be a reload API that might update the dashboards without going through the whole Grafana restart: https://grafana.com/docs/grafana/latest/developers/http_api/admin/#reload-provisioning-configurations
Could you have a look if that doesn't fix your issue in a better way?
@mmkay this may work, but it would involve adding a lot more logic to the charm:
I think this is probably more work than is worth it to fix this bug? Also we seem to restart grafana fairly often on changes; we've just missed restarting in this case. What are your thoughts on this?
Hi @mmkay , could you take another look at this? Thanks :)
Hi @mmkay , could you take another look at this? Thanks :)
Hey @samuelallan72 - I've rebased the branch to newest main and integration tests seem to be failing in the PR. At first sight it looks like there might be errors around the restart timing so this might require a deeper look. We have the issue in our team's minds so will likely get back to it in near future.
Thanks for looking into it @mmkay ! I don't have much time right now to investigate the tests, but I can try when I do have time if you haven't already. :grin:
Note that there may be a better or more efficient method for deciding when to restart grafana to get it to pick up the dashboard changes. This was just a method that worked for me and seemed a reasonable starting point.
This ensures that dashboard changes are picked up by grafana.
Fixes #303