Skip to content
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

PDF does not display some views #4

Open
U17205367 opened this issue Sep 3, 2024 · 3 comments
Open

PDF does not display some views #4

U17205367 opened this issue Sep 3, 2024 · 3 comments
Assignees

Comments

@U17205367
Copy link

It generates the PDF report but I have 2 visualizations where the query is somewhat heavy, which is why it takes between 15 and 30 seconds to load the information depending on the time range I choose, so in the PDF that part comes out blank. Is there a way I can validate that all the visualizations have actually loaded before generating the PDF?

image

@arthur-mdn
Copy link
Owner

Hello,
As this is an experimental development, I haven't included it on the main branch yet. Waiting to see if it is not causing troubles.

You need to pull the checkForAllQueriesToComplete branch.
https://github.com/arthur-mdn/ExportGrafanaDashboardToPDF/tree/checkForAllQueriesToComplete

And add these in your .env :

CHECK_QUERIES_TO_COMPLETE=true
CHECK_QUERIES_TO_COMPLETE_MAX_QUERY_COMPLETION_TIME=30000
CHECK_QUERIES_TO_COMPLETE_QUERIES_COMPLETION_TIMEOUT=60000

Please try and tell me if the issue is solved.

@U17205367
Copy link
Author

Hello, I just tried the modified code and it works but with some modifications.

If I try to generate the PDF with the original code that you have modified, it gives me an error first because it detects 18 queries and in reality there are more because it validates that 19 have been completed

image

Analyzing the code in detail I could see that in the json you enter the array of the panels and only consider those that have the targets attribute, I modified this line so that it counts all of them

const count = json.dashboard.panels.length;

And then I saw that the interval variable is set to 2000ms, that means that if there are no changes in 2 seconds it detects it as a block and ends with an error, so I modified this variable from 2000ms to 20000ms, that is, 20 seconds

const interval = 20000;

After this change, the PDF was generated successfully and the panels that appeared blank now appear as they should be.

image

image

Thank you very much for your time in modifying the code.

@nelsontr
Copy link

Hi! Just checking in on the progress.
What's missing for a master branch merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants