Closed boberty88 closed 6 years ago
Yes, I think inside func GetPanelPng would be a good place. The Grafana API should contain the logic for connection handling to the Grafana back-end so this seems like the correct place. Retry 5 times and then fail and return an error.
Instead of adding the delays in the func renderPNGsParallel, you could have a delay between your retry attempts. That way users don't have to wait unnecessarily when all PNGs could be retrieved successfully. When there is a problem with back-end load, the delay between failed attempts should ease the load.
If you've get something working well, I would appreciate a pull request.
We have this working well, just move the delay after the
go func (p grafana.Panel)
Line, does each API call separately
It would be useful to be able to retry the requests for the panels during the "Downloading image..." part of the application. I have had the problem where some of the panels I'm loading time-out or fail to render properly.
From the logs:
These can happen on even simple Text panels if the dashboard contains more than 60+ widgets/panels.
Currently we have implemented a delay in rendering each of the panels in the report.go code. This allows me to go through each of the images sequentially and not overwhelm InfluxDB by hitting it with too many queries at the same time. I'm not concerned with how long it takes as I just want it to email me the PDF report when it's done.
My question is where is the appropriate place to wrap a retry of the Panel API request so that if it fails to load the first time I can try it again (maybe a max of 5 attempts)?
I thought it may be inside the func GetPanelPng in api.go? Or in the func renderPNGsParallel or func renderPNG in report.go?
I'm a complete newbie to Go code so your help is much appreciated.