ruby-grafana-reporter icon indicating copy to clipboard operation
ruby-grafana-reporter copied to clipboard

Add support for Grafana Expressions?

Open bolausson opened this issue 5 months ago • 1 comments

Hello,

is there any chance you will add support for Grafana "Expressions"?

Greetings, Bjoern

Describe the issue Due to a bug (or limitation) in the data source (Mimir) I am unfortunately forced to use a Expression in Grafana ${Rack01Left}+${Rack01Right}

Which leads to the error: GrafanaError: The datasource request returned with an unsupported response format (received: {"results":{"A": "error":"json: cannot unmarshal object into Go struct field internalQueryModel.PrometheusQueryProperties.expr of type string","errorSource":"plugin","status":500}}} ). (Grafana::UnsupportedQueryResponseReceivedError)

Image

I do understand from a previous post, that expressions are not supported.

Last time I found a workaround by suming up the values using a prometheus query: sum(delta(st4InputCordEnergy{st4UnitName=~"Left-Back-sec|Right-Back-pri"}[$__range])) / 10 This workaround is no longer possible because Mimir barfs on the time range I have to sum up :-(

Application call

  • type of call [webservice or single-run]: Webservice & single run
  • call of report creation, if running as webservice [e.g. http://localhost/render?var-template=test]: render?var-template=power_report_snapshot&from=now%2FM&to=now&timezone=Europe%2FBerlin& or ruby-grafana-reporter --config ./grafana_reporter.config --template ./power_report.adoc --output ./power_report.adoc.pdf

Template file (if applicable)

grafana_panel_query_value:1[dashboard="fdn1njnosc83ke",query="Rack01Sum",select_value="last",instant="true",format="%.2f,%.2f",filter_columns="Time"]

Environment (please complete the following information):

  • OS [e.g. Windows 10]: Ubuntu 24.04
  • Grafana version [e.g. 6.3.4]: Grafana v12.1.0 (1fdeca1015)
  • Environment [e.g. source, gem, docker or windows-exe]: GEM
  • Ruby Version, if source or gem environment [e.g. 2.3.7]: 3.0.2p107
  • Reporter version [e.g. 0.3.0]: 0.9.4

bolausson avatar Oct 21 '25 21:10 bolausson

Thanks for using this tool. I did not add support for this feature yet and I don't have any knowledge, how easy it can be integrated.

I am currently not focussing on adding functionalities to this tool, but if you are interested in developing it, feel free to provide a PR and I will consider integrating it after review.

divinity666 avatar Oct 28 '25 22:10 divinity666