divinity666 / ruby-grafana-reporter

Reporting Service for Grafana
MIT License
73 stars 5 forks source link

Error during image rendering #5

Closed ipats86 closed 3 years ago

ipats86 commented 3 years ago

Hello, I am trying to export my first pdf report from a Grafana installation but unfortunately, I receive the below Fatal errors during the creation process.

FATAL -- : undefined method []' for nil:NilClass FATAL -- : undefined methodid' for nil:NilClass FATAL -- : uninitialized constant GrafanaReporter::PanelImageQuery::ImageCouldNotBeRenderedError FATAL -- : undefined method []' for nil:NilClass FATAL -- : undefined methodid' for nil:NilClass FATAL -- : uninitialized constant GrafanaReporter::PanelImageQuery::ImageCouldNotBeRenderedError

Application call

Template file (if applicable)

Configuration file

grafana-reporter: report-class: GrafanaReporter::Asciidoctor::Report templates-folder: ./templates reports-folder: ./reports report-retention: 24 webservice-port: 8815



**Environment (please complete the following information):**
 - OS [e.g. Windows 10]: CentOS Linux release 7.8.2003
 - Environment [e.g. source, gem, docker or windows-exe]: gem
 - ruby Version, if source or gem environment [e.g. 2.3.7]: ruby 2.7.0p0 
 - reporter Version [e.g. 0.3.0]: v0.4.1
divinity666 commented 3 years ago

Thanks for your error report.

Unfortunately it looks like you found a part of the 5% missing test coverage... well done! :-)

As of this bug, I am now only guessing. Please try to render the panel manually in grafana. Therefore click on the title and select "Share" image

Select the rendering link image

Do you get something like this? Or do you get a working image as a result? image

If you receive such an error message, please install the grafana image rendering plugin, 'cause otherwise grafana is not capable in providing images.

Further questions (if not already solved by the above): Did you create the demo report manually, or by using the wizard? Could you please provide the image rendering portions of your demo report? Try removing the grafana_panel_image rendering rows from your report file. Is it then rendering properly?

ipats86 commented 3 years ago

Hello,

Thank you very much for your prompt response. It seems like I hit the jackpot!

At first the direct link rendered image wasn’t working besides the installation of the grafana image rendering plugin. I found the solution posted in the below issue and now when I click on the Direct rendered image link, the image is rendered with success in a separate tab!!

https://github.com/grafana/grafana-image-renderer/issues/159

image

When I start the ruby-grafana-reporter and try to create the report from the Link button, the panels are still not printed in the pdf file. I get the below Fatal errors:

F, [2021-05-18T23:37:11.215734 #25593] FATAL -- : undefined method []' for nil:NilClass F, [2021-05-18T23:37:11.217283 #25593] FATAL -- : undefined methodid' for nil:NilClass F, [2021-05-18T23:37:15.103025 #25593] FATAL -- : undefined method []' for nil:NilClass F, [2021-05-18T23:37:15.121621 #25593] FATAL -- : undefined methodid' for nil:NilClass

I also notice some warnings:

/usr/local/rvm/gems/ruby-2.7.0/gems/ruby-grafana-reporter-0.4.0/lib/grafana_reporter/abstract_query.rb:94: warning: deprecated Object#=~ is called on Integer; it always returns nil

/usr/local/rvm/gems/ruby-2.7.0/gems/ruby-grafana-reporter-0.4.0/lib/grafana_reporter/abstract_query.rb:94: warning: deprecated Object#=~ is called on Integer; it always returns nil

/usr/local/rvm/gems/ruby-2.7.0/gems/ruby-grafana-reporter-0.4.0/lib/grafana_reporter/abstract_query.rb:94: warning: deprecated Object#=~ is called on Integer; it always returns nil

Thank you very much for your time!!

divinity666 commented 3 years ago

Nice to see, that the image rendering is now working properly in your grafana instance.

To hunt down the issue, would you kindly provide additional information:

Thanks and best regards

divinity666 commented 3 years ago

Closing because of missing further information.