IzakMarais / reporter

Service that generates a PDF report from a Grafana dashboard
Apache License 2.0
958 stars 308 forks source link

Add option to expand Collapsed panels in pdf #124

Open knockingOn opened 5 years ago

knockingOn commented 5 years ago

The collapsed panels containing multiple graphs are not captured in the pdf report. Only expanded ones are being captured am i doing something wrong?

IzakMarais commented 5 years ago

Hmm this could either be a bug in the reporter or an artifact of the way the Grafana API responds to dashboard requests. The reporter requests the dashboard JSON from Grafana and iterates over all the panels, downloading them and then adding them to a structure to render the LaTeX doc. This issue will require investigating that interaction.

knockingOn commented 5 years ago

Is there any way in Grafana where i can specify all panels to be expanded while the dashboard loads up? although this question is little bit off topic.. but asking for the help anyway.. since you seem to be familiar with Grafana as well. Thank You

IzakMarais commented 5 years ago

I think if you save the dashboard with all the panels expanded that should work.


From: knockingOn notifications@github.com Sent: Wednesday, 08 May 2019 11:58 To: IzakMarais/reporter Cc: Izak Marais; Comment Subject: Re: [IzakMarais/reporter] Collapsed panels not captured in pdf (#124)

Is there any way in Grafana where i can specify all panels to be expanded while the dashboard loads up? although this question is little bit off topic.. but asking for the help anyway.. since you seem to be familiar with Grafana as well. Thank You

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

IzakMarais commented 5 years ago

Any feedback on whether saving the dashboard with panels expanded solves this problem?

amirmalka commented 4 years ago

@IzakMarais We are facing the same issue. A workaround is indeed to save the dashboard JSON with all panels expanded, but it's not a good solution overall. Any chance for a fix?

IzakMarais commented 4 years ago

From a quick look at the dashboard JSON returned for collapsed panels, it seems like all the needed information is still there. The conclusion is that this is a bug in the reporter.

amirmalka commented 4 years ago

@IzakMarais Thanks for the prompt response! Do you think it will be fixed anytime soon?

IzakMarais commented 4 years ago

If someone else submits a PR I would be happy to merge it.

If not, it will have to wait until I find some time to work on this project again, which will definitely not be before next year.

amirmalka commented 4 years ago

@IzakMarais waiting for your kind approval :)

chelliwell commented 4 years ago

What would this change do if the dashboard default is 'collapsed'? I would prefer it if the report followed the dashboard default, not simply automatically expand everything.

IzakMarais commented 4 years ago

@chelliwell thanks for the comment, I had not even thought of that. O bother! @amirmalka any ideas?

chelliwell commented 4 years ago

I recognise that you are constrained quite a lot by what the Grafana API makes possible. (e.g. Annotations in the pdf would be fantastic, but I've no idea how you would get them!) Given those constraints, I think there is some case for not blindly over-riding what Grafana presents - if you don't have the ability to control what it generates then I think it fair if the 'problem' (timezone, collapsed panels etc) are treated as being due to Grafana and/or the dashboard, not your code. You're essentially using their API - if that is missing some features then it's not your fault! ;)

amirmalka commented 4 years ago

@chelliwell I understand this need, I thought about it too. Maybe we can leave the default as it is and give an option/flag to generate the 'full' dashboard? What do you think?

chelliwell commented 4 years ago

@chelliwell I understand this need, I thought about it too. Maybe we can leave the default as it is and give an option/flag to generate the 'full' dashboard? What do you think?

I haven't looked at what controls Reporter has over requesting collapsed vs. expanded. My own uses will be two types: from the Grafana web UI, where I'd definitely prefer Reporter to capture how I have the web page showing at that time. But also from command line - if that is the dashboard defaults then I think that is justified; if there's an over-ride option available to 'expand all' then fair enough, I can see that being useful. Of course someone will then want to be able to specify which to expand..... :S ;)

IzakMarais commented 3 years ago

Sorry for the long time between replies.

Maybe we can leave the default as it is and give an option/flag to generate the 'full' dashboard? What do you think?

This sounds like a good plan to me. @amirmalka If you include it in the PR that would be good.

Of course someone will then want to be able to specify which to expand..... :S ;)

Lets not go there, that seems too complex.