elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.66k stars 8.23k forks source link

[Reporting] Kibana normal PDF reports have cut visualizations and printable PDFs have cut labels #89555

Closed dminovski0 closed 3 years ago

dminovski0 commented 3 years ago

*Kibana version: 7.10.2*

*Elasticsearch version: 7.10.2*

*Server OS version: Managed by elastic.co, Azure*

*Browser version: Chrome 88.0.4324.104*

*Browser OS version: Windows 10 64-bit*

*Original install method (e.g. download page, yum, from source, etc.): apt-get from official documentation*

*Describe the bug: Two bugs:

  1. The PDF normal reports' visualizations are cut towards the bottom if the dashboards are longer.
  2. When selecting a printing optimized report, if the labels of the visualizations are longer, they continue past their boundaries and break out of the page.*

Steps to reproduce:

  1. Go to the dashboard, click Share from the top menu -> PDF reports.
  2. For the first bug, leave Optimize for printing on OFF, for the second toggle it to be ON.
  3. Click Generate PDF.

*Expected behavior: The reports in Stack Management -> Alerts and Insights -> Reporting -> should be whole and uncut.*

*Screenshots (if relevant): Cut visualizations in normal PDF printing, their titles are at the top of the images, but their bodies are below or missing. Cut visualizations Cut labels in printable optimized PDF printing, they overflow through the page's boundaries on the right side. Cut labels in printable PDF

Errors in browser console (if relevant):

Provide logs and/or server output (if relevant):

*Any additional context: In Kibana's Status page, the Heap total is 1.42 GB and during the printing, the heap used went up to 200 MB.

tsullivan commented 3 years ago

Could be a duplicate of https://github.com/elastic/kibana/issues/85864 which was opened and fixed for 7.11

However, https://github.com/elastic/kibana/pull/85066 should not have been backported to 7.10, so I'm not sure how the issue would be present in 7.10

dminovski0 commented 3 years ago

@tsullivan Thanks for the reply. We are using a cluster on the cloud, and the latest version we can upgrade to is 7.10.2. There isn't an option for 7.11.

tsullivan commented 3 years ago

Understood thanks.

I was not able to repro on a Linux server. I'll try Windows next.

elasticmachine commented 3 years ago

Pinging @elastic/kibana-app-services (Team:AppServices)

elasticmachine commented 3 years ago

Pinging @elastic/kibana-reporting-services (Team:Reporting Services)

tsullivan commented 3 years ago

Depends on https://github.com/elastic/kibana/issues/90496

marekduciuc commented 3 years ago

The user with thsi https://github.com/elastic/sdh-kibana/issues/1316 would thi to be fixed ASAP is there any ETA for fix?

ppisljar commented 3 years ago

we need to build a new version of chromium, @tsullivan is working on it. @tsullivan do you think this is gonna make 7.13?

tsullivan commented 3 years ago

@tsullivan do you think this is gonna make 7.13?

It's planned for 7.14

tsullivan commented 3 years ago

The new build will allow us to stop increasing the browser viewport size before capture, which causes rendering artifacts because the embeddables are forced to re-render (they have resize handlers). That is one cause of failures with large dashboards.

Another cause is that Chromium limits the size of a screenshot capture to 16384 pixels. Earlier code in Kibana (before we had Puppeteer) did have a solution for this: https://github.com/elastic/kibana/pull/21788/files#diff-9744794bc3db91c2ab0e7eecbbf1664cde77fa26e10b95ff981b6b2dc8f2f893L94. That code was removed - maybe there was a misunderstanding in thinking that Puppeteer provided that.

The two things that need to happen for this:

tsullivan commented 3 years ago

This will be fixed along with https://github.com/elastic/kibana/issues/90496

dminovski0 commented 2 years ago

@tsullivan Using Kibana 7.17.0, the medium-sized dashboards are getting their visualizations cut and partially grayed out again. Is this https://github.com/elastic/kibana/issues/90496 Puppeteer upgrade applied to 7.17.0, or only to 8.0?

tsullivan commented 2 years ago

@dminovski0 sorry about this, but there is a newer issue (7.16+) regarding images in a PDF or PNG of a dashboard appearing stretched or blank. Can you check if your customer is facing this issue: https://github.com/elastic/sdh-kibana/issues/2510#

dminovski0 commented 2 years ago

@tsullivan The link leads to Page not found. Yes, some of the visualizations appear blank: image

tsullivan commented 2 years ago

@dminovski0

The link leads to Page not found

That's strange. Did maybe you try to access it in a non-logged-in browser?

Based on your screenshot it sounds like this is the same issue. I paste the same advice as stated in that issue:

dminovski0 commented 2 years ago

@tsullivan I'm logged in.

image

I tried with 32GB RAM and Kibana 7.17.0 on Windows 10 Pro connected to the cloud cluster, and there are blank visualizations. But the location of the visualizations that get blank is different. With Windows Kibana, the blankness is in the top right half of the dashboard. With Windows, setting the --max-old-space-size=32768 in node.options doesn't seem to increase the RAM in the app status page on the route http://localhost:5601/app/status. Adding this parameter to /bin/kibana.bat then shows the RAM as increased.

image

With Ubuntu Kibana and 4 GB RAM, the blankness appears in the bottom left half.

image

dminovski0 commented 2 years ago

I tried this with Kibana 8.1.1 hosted locally on Windows. The reporting job fails when printing a PDF or PNG with an error message Error: Max attempts (3) reached for job l14sirv90d8008096af87pf0. Failed with: Error: Protocol error (Page.captureScreenshot): Unable to capture screenshot. The dashboard has Height in pixels 30668 px, Width in pixels 1904 px, and about 200 visualizations. Printing an "Optimize for printing" PDF, it prints with a warning only the first two visualizations on a single PDF page, and there is only that page. The RAM is set to 32 GB with --max-old-space-size=32768. Kibana 8 1 1 PDF create report error info . image

tsullivan commented 2 years ago

The RAM is set to 32 GB with --max-old-space-size=32768.

@dminovski0 The system RAM is 32 GB? 32768 megabytes is 32 GB. If you have Node reserve all of the system's RAM, there won't be enough free RAM for the spawned Chromium process that needs to open the Kibana tab on the server.

dminovski0 commented 2 years ago

@tsullivan I tried setting the RAM to --max-old-space-size=4096, and 8192 and 16384, in kibana.bat, and nothing in node.options. This is Elastic and Kibana 8.1.1. The same message gets returned: Failed with: Error: Protocol error (Page.captureScreenshot): Unable to capture screenshot on Chrome and Firefox.

[2022-03-31T22:30:23.742+02:00][INFO ][plugins.screenshotting.screenshot] handled 150 page requests [2022-03-31T22:30:38.687+02:00][INFO ][plugins.screenshotting.screenshot] timeRange: Mar 31, 1962 @ 22:30:24.835 to Mar 31, 2022 @ 22:30:24.835 [2022-03-31T22:30:38.689+02:00][INFO ][plugins.screenshotting.screenshot] taking screenshots [2022-03-31T22:30:43.749+02:00][ERROR][plugins.reporting.runTask.printablePdfV2.printable_pdf_v2.execute-job.l1fgb8db04rk08096aaap4jc] Error: Protocol error (Page.captureScreenshot): Unable to capture screenshot at D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:217:63 at new Promise () at CDPSession.send (D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:216:16) at Page._screenshotTask (D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1958:43) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) [2022-03-31T22:30:43.754+02:00][ERROR][plugins.reporting.runTask] Error: Protocol error (Page.captureScreenshot): Unable to capture screenshot at D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:217:63 at new Promise () at CDPSession.send (D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:216:16) at Page._screenshotTask (D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1958:43) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) [2022-03-31T22:30:43.761+02:00][INFO ][plugins.reporting.runTask] Rescheduling task:l1fgb8db04rk08096aaap4jc to retry after error. [2022-03-31T22:30:45.180+02:00][INFO ][plugins.reporting.runTask.printablePdfV2.printable_pdf_v2.execute-job.l1fgb8db04rk08096aaap4jc] Generating request for space: hmm4 [2022-03-31T22:30:45.180+02:00][INFO ][plugins.reporting.runTask.printablePdfV2.printable_pdf_v2.execute-job.l1fgb8db04rk08096aaap4jc] Request uses Space ID: hmm4 [2022-03-31T22:30:45.181+02:00][INFO ][plugins.reporting.runTask.printablePdfV2.printable_pdf_v2.execute-job.l1fgb8db04rk08096aaap4jc] Creating UI Settings Client for space: hmm4 [2022-03-31T22:30:45.188+02:00][INFO ][plugins.screenshotting.screenshot.browser-driver] Creating browser page driver [2022-03-31T22:30:45.394+02:00][INFO ][plugins.screenshotting.screenshot] opening url http://localhost:5601/s/hmm4/app/reportingRedirect?forceNow=2022-03-31T20%3A30%3A18.905Z [2022-03-31T22:30:45.790+02:00][ERROR][plugins.screenshotting.screenshot.browser-driver.headless-browser-console] Error in browser console: { message: "Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution. ", url: "http://localhost:5601/s/hmm4/app/reportingRedirect?forceNow=2022-03-31T20%3A30%3A18.905Z" } [2022-03-31T22:30:47.427+02:00][INFO ][plugins.screenshotting.screenshot] handled 150 page requests [2022-03-31T22:31:02.736+02:00][INFO ][plugins.screenshotting.screenshot] timeRange: Mar 31, 1962 @ 22:30:48.531 to Mar 31, 2022 @ 22:30:48.531 [2022-03-31T22:31:02.746+02:00][INFO ][plugins.screenshotting.screenshot] taking screenshots [2022-03-31T22:31:07.845+02:00][ERROR][plugins.reporting.runTask.printablePdfV2.printable_pdf_v2.execute-job.l1fgb8db04rk08096aaap4jc] Error: Protocol error (Page.captureScreenshot): Unable to capture screenshot at D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:217:63 at new Promise () at CDPSession.send (D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:216:16) at Page._screenshotTask (D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1958:43) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) [2022-03-31T22:31:07.847+02:00][ERROR][plugins.reporting.runTask] Error: Protocol error (Page.captureScreenshot): Unable to capture screenshot at D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:217:63 at new Promise () at CDPSession.send (D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:216:16) at Page._screenshotTask (D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1958:43) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) [2022-03-31T22:31:07.847+02:00][INFO ][plugins.reporting.runTask] Rescheduling task:l1fgb8db04rk08096aaap4jc to retry after error. [2022-03-31T22:31:09.257+02:00][INFO ][plugins.reporting.runTask.printablePdfV2.printable_pdf_v2.execute-job.l1fgb8db04rk08096aaap4jc] Generating request for space: hmm4 [2022-03-31T22:31:09.257+02:00][INFO ][plugins.reporting.runTask.printablePdfV2.printable_pdf_v2.execute-job.l1fgb8db04rk08096aaap4jc] Request uses Space ID: hmm4 [2022-03-31T22:31:09.258+02:00][INFO ][plugins.reporting.runTask.printablePdfV2.printable_pdf_v2.execute-job.l1fgb8db04rk08096aaap4jc] Creating UI Settings Client for space: hmm4 [2022-03-31T22:31:09.263+02:00][INFO ][plugins.screenshotting.screenshot.browser-driver] Creating browser page driver [2022-03-31T22:31:09.471+02:00][INFO ][plugins.screenshotting.screenshot] opening url http://localhost:5601/s/hmm4/app/reportingRedirect?forceNow=2022-03-31T20%3A30%3A18.905Z [2022-03-31T22:31:09.844+02:00][ERROR][plugins.screenshotting.screenshot.browser-driver.headless-browser-console] Error in browser console: { message: "Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'unsafe-eval' 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-P5polb1UreUSOe5V/Pv7tc+yeZuJXiOi/3fqhGsU7BE='), or a nonce ('nonce-...') is required to enable inline execution. ", url: "http://localhost:5601/s/hmm4/app/reportingRedirect?forceNow=2022-03-31T20%3A30%3A18.905Z" } [2022-03-31T22:31:11.240+02:00][INFO ][plugins.screenshotting.screenshot] handled 151 page requests [2022-03-31T22:31:26.710+02:00][INFO ][plugins.screenshotting.screenshot] timeRange: Mar 31, 1962 @ 22:31:12.528 to Mar 31, 2022 @ 22:31:12.528 [2022-03-31T22:31:26.712+02:00][INFO ][plugins.screenshotting.screenshot] taking screenshots [2022-03-31T22:31:31.769+02:00][ERROR][plugins.reporting.runTask.printablePdfV2.printable_pdf_v2.execute-job.l1fgb8db04rk08096aaap4jc] Error: Protocol error (Page.captureScreenshot): Unable to capture screenshot at D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:217:63 at new Promise () at CDPSession.send (D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Connection.js:216:16) at Page._screenshotTask (D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\node_modules\puppeteer\lib\cjs\puppeteer\common\Page.js:1958:43) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) [2022-03-31T22:31:31.774+02:00][ERROR][plugins.reporting.runTask] Error: Max attempts (3) reached for job l1fgb8db04rk08096aaap4jc. Failed with: Error: Protocol error (Page.captureScreenshot): Unable to capture screenshot at Object.run (D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\x-pack\plugins\reporting\server\lib\tasks\execute_report.js:423:58) at runMicrotasks () at processTicksAndRejections (node:internal/process/task_queues:96:5) at TaskManagerRunner.run (D:\ELK\kibana-8.1.1-windows-x86_64\kibana-8.1.1\x-pack\plugins\task_manager\server\task_running\task_runner.js:296:22)