class GrafanaReporter::PanelImageQuery
This class is used to create an image out of a {Grafana::Panel}.
Public Instance Methods
post_process()
click to toggle source
Returns the body of the http query, which contains the raw image.
# File lib/grafana_reporter/panel_image_query.rb, line 16 def post_process @result = @result[:content].first raise ::Grafana::ImageCouldNotBeRenderedError, @panel if @result.include?('<html') end
pre_process()
click to toggle source
Sets the proper render variables.
# File lib/grafana_reporter/panel_image_query.rb, line 7 def pre_process # TODO: properly show error, if a (maybe a repeated template) panel can not be rendered # TODO: ensure that in case of timezones are specified, that they are also forwarded to the image renderer # rename "render-" variables @variables = @variables.each_with_object({}) { |(k, v), h| h[k.gsub(/^render-/, '')] = v } @datasource = Grafana::ImageRenderingDatasource.new(nil) end
raw_query()
click to toggle source
# File lib/grafana_reporter/panel_image_query.rb, line 22 def raw_query { panel: @panel } end