divinity666 / ruby-grafana-reporter

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

Datasource format changed in recent Grafana panel JSON #22

Closed ttm92 closed 1 year ago

ttm92 commented 2 years ago

Describe the issue

The functionality to have dynamic contents as tables based on grafana panel queries or custom database queries (no images!) is great. I have been try to implement it, but I had 2 issues :

1) First I had a problem about the existence of the datasource. ERROR -- : GrafanaError: Datasource with name '{"type"=>"mysql", "uid"=>"8IaMSWh7k"}' does not exist. (Grafana::DatasourceDoesNotExistError) In the JSON of Grafana v8.3.6 panels, we see that there is no longer the name of the datasource which is transmitted as a parameter but only the type and the uid. Can the plugin use the uid instead of the name? And how?

2) Once I did a workaround for the datasource names problem, I had a second problem. The Grafana tsdb/query API has apparently changed, the result is no longer in JSON form but they use dataframes instead. Is the plugin compatible with dataframes? If yes how to configure it? If not, is this development planned in the roadmap?

Environment (please complete the following information): OS [e.g. Windows 10]: Linux Environment [e.g. source, gem, docker or windows-exe]: source ruby Version, if source or gem environment [e.g. 2.3.7]: 2.7.5 reporter Version [e.g. 0.3.0]:0.5.1

divinity666 commented 2 years ago

Thanks for using the reporter.

Your points are well analyzed and absolutely valid. Thanks for the precise report.

I just fixed the issues (hopefully proper enough) and provided a new release. It would be great to receive your feedback.

FYI: I only supported dataframes for Prometheus for now, but there maybe additional datasources which need to handle that format.

ttm92 commented 2 years ago

Thanks for the quick answer. I will test it and give the feedback soon. Regarding the dataframes, it would be great if you can also implement it for all sql based datasources. Thanks in advance.

divinity666 commented 2 years ago

I added support for dataframes for the next release for all reporter datasources. It will be part of the next release.