divinity666 / ruby-grafana-reporter

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

The reporter failed with GrafanaError: The datasource request returned with an unsupported response format #28

Closed emanzx closed 1 year ago

emanzx commented 2 years ago

Describe the issue I try to use grafana_panel_query_value in my report but the reporter return an error mentioning unsupported response format. Below are full log.

I, [2022-06-27T07:45:18.579079 #74862]  INFO -- : Server listening on port 5050...
I, [2022-06-27T07:45:38.929898 #74862]  INFO -- : 1 report(s) in progress: 0% (running 0 secs)
I, [2022-06-27T07:45:38.930262 #74862]  INFO -- : Report started at 2022-06-27 07:45:38 +0000
I, [2022-06-27T07:45:38.930310 #74862]  INFO -- : You are running ruby-grafana-reporter version 0.5.4.
I, [2022-06-27T07:45:43.947681 #74862]  INFO -- : 1 report(s) in progress: 6% (running 5 secs)
I, [2022-06-27T07:45:48.967751 #74862]  INFO -- : 1 report(s) in progress: 6% (running 10 secs)
I, [2022-06-27T07:45:54.014023 #74862]  INFO -- : 1 report(s) in progress: 6% (running 15 secs)
I, [2022-06-27T07:45:59.067761 #74862]  INFO -- : 1 report(s) in progress: 6% (running 20 secs)
E, [2022-06-27T07:46:02.224818 #74862] ERROR -- : GrafanaError: The specified panel id ':70' does not exist on the dashboard 'RzLX0d3nk'. (Grafana::PanelDoesNotExistError)
I, [2022-06-27T07:46:04.093955 #74862]  INFO -- : 1 report(s) in progress: 85% (running 25 secs)
I, [2022-06-27T07:46:09.147691 #74862]  INFO -- : 1 report(s) in progress: 85% (running 30 secs)
I, [2022-06-27T07:46:14.167670 #74862]  INFO -- : 1 report(s) in progress: 85% (running 35 secs)
I, [2022-06-27T07:46:19.223961 #74862]  INFO -- : 1 report(s) in progress: 85% (running 40 secs)
I, [2022-06-27T07:46:24.247214 #74862]  INFO -- : 1 report(s) in progress: 85% (running 45 secs)
I, [2022-06-27T07:46:29.266857 #74862]  INFO -- : 1 report(s) in progress: 85% (running 50 secs)
I, [2022-06-27T07:46:34.347697 #74862]  INFO -- : 1 report(s) in progress: 85% (running 55 secs)
I, [2022-06-27T07:46:39.366280 #74862]  INFO -- : 1 report(s) in progress: 85% (running 60 secs)
I, [2022-06-27T07:46:44.409345 #74862]  INFO -- : 1 report(s) in progress: 85% (running 65 secs)
I, [2022-06-27T07:46:49.414752 #74862]  INFO -- : 1 report(s) in progress: 85% (running 70 secs)
I, [2022-06-27T07:46:54.422882 #74862]  INFO -- : 1 report(s) in progress: 85% (running 75 secs)
I, [2022-06-27T07:46:59.447698 #74862]  INFO -- : 1 report(s) in progress: 85% (running 80 secs)
I, [2022-06-27T07:47:04.467683 #74862]  INFO -- : 1 report(s) in progress: 85% (running 85 secs)
I, [2022-06-27T07:47:09.524027 #74862]  INFO -- : 1 report(s) in progress: 87% (running 90 secs)
I, [2022-06-27T07:47:14.567711 #74862]  INFO -- : 1 report(s) in progress: 87% (running 95 secs)
I, [2022-06-27T07:47:19.583938 #74862]  INFO -- : 1 report(s) in progress: 87% (running 100 secs)
I, [2022-06-27T07:47:24.613933 #74862]  INFO -- : 1 report(s) in progress: 87% (running 105 secs)
I, [2022-06-27T07:47:29.647715 #74862]  INFO -- : 1 report(s) in progress: 87% (running 110 secs)
I, [2022-06-27T07:47:34.657214 #74862]  INFO -- : 1 report(s) in progress: 87% (running 115 secs)
I, [2022-06-27T07:47:39.667705 #74862]  INFO -- : 1 report(s) in progress: 87% (running 120 secs)
I, [2022-06-27T07:47:44.683911 #74862]  INFO -- : 1 report(s) in progress: 87% (running 125 secs)
I, [2022-06-27T07:47:49.712368 #74862]  INFO -- : 1 report(s) in progress: 87% (running 130 secs)
I, [2022-06-27T07:47:54.767666 #74862]  INFO -- : 1 report(s) in progress: 87% (running 135 secs)
I, [2022-06-27T07:47:59.832317 #74862]  INFO -- : 1 report(s) in progress: 87% (running 140 secs)
I, [2022-06-27T07:48:04.842883 #74862]  INFO -- : 1 report(s) in progress: 87% (running 145 secs)
I, [2022-06-27T07:48:09.855256 #74862]  INFO -- : 1 report(s) in progress: 87% (running 150 secs)
I, [2022-06-27T07:48:14.867724 #74862]  INFO -- : 1 report(s) in progress: 87% (running 155 secs)
I, [2022-06-27T07:48:19.905231 #74862]  INFO -- : 1 report(s) in progress: 87% (running 160 secs)
I, [2022-06-27T07:48:24.947688 #74862]  INFO -- : 1 report(s) in progress: 89% (running 166 secs)
I, [2022-06-27T07:48:29.967697 #74862]  INFO -- : 1 report(s) in progress: 91% (running 171 secs)
I, [2022-06-27T07:48:35.037928 #74862]  INFO -- : 1 report(s) in progress: 91% (running 176 secs)
I, [2022-06-27T07:48:40.047741 #74862]  INFO -- : 1 report(s) in progress: 91% (running 181 secs)
I, [2022-06-27T07:48:45.099682 #74862]  INFO -- : 1 report(s) in progress: 91% (running 186 secs)
I, [2022-06-27T07:48:50.140130 #74862]  INFO -- : 1 report(s) in progress: 91% (running 191 secs)
I, [2022-06-27T07:48:55.145869 #74862]  INFO -- : 1 report(s) in progress: 91% (running 196 secs)
I, [2022-06-27T07:49:00.167704 #74862]  INFO -- : 1 report(s) in progress: 91% (running 201 secs)
I, [2022-06-27T07:49:05.199726 #74862]  INFO -- : 1 report(s) in progress: 91% (running 206 secs)
I, [2022-06-27T07:49:10.267661 #74862]  INFO -- : 1 report(s) in progress: 91% (running 211 secs)
I, [2022-06-27T07:49:15.347678 #74862]  INFO -- : 1 report(s) in progress: 91% (running 216 secs)
I, [2022-06-27T07:49:20.367680 #74862]  INFO -- : 1 report(s) in progress: 91% (running 221 secs)
I, [2022-06-27T07:49:25.427283 #74862]  INFO -- : 1 report(s) in progress: 91% (running 226 secs)
I, [2022-06-27T07:49:30.447672 #74862]  INFO -- : 1 report(s) in progress: 91% (running 231 secs)
I, [2022-06-27T07:49:35.464028 #74862]  INFO -- : 1 report(s) in progress: 93% (running 236 secs)
I, [2022-06-27T07:49:40.522905 #74862]  INFO -- : 1 report(s) in progress: 93% (running 241 secs)
I, [2022-06-27T07:49:45.583932 #74862]  INFO -- : 1 report(s) in progress: 93% (running 246 secs)
E, [2022-06-27T07:49:48.379877 #74862] ERROR -- : GrafanaError: The datasource request returned with an unsupported response format (received: {"status":"success","data":{"resultType":"vector","result":[]}}). (Grafana::UnsupportedQueryResponseReceivedError)
I, [2022-06-27T07:49:48.550937 #74862]  INFO -- : Report creation ended after 250 seconds with status 'finished'

here are the query

sum(netdata_system_cpu_percentage_average{dimension!="idle",instance="xxxx.local"})

here are info I get from grafana query inspector

{
  "request": {
    "url": "api/datasources/proxy/7/api/v1/query",
    "method": "POST",
    "data": {
      "query": "sum(netdata_system_cpu_percentage_average{dimension!=\"idle\",instance=\"xxxx.local\"})",
      "time": 1656319407
    },
    "hideFromInspector": false
  },
  "response": {
    "status": "success",
    "data": {
      "resultType": "vector",
      "result": [
        {
          "metric": {},
          "value": [
            1656319407,
            "15.6938131"
          ]
        }
      ]
    }
  }
}

Application call

Template file (if applicable)

Configuration file

grafana: default: host: http://cm.xxx.xxx.net:5555 api_key: xxxx

grafana-reporter:

Specifies how often the reporter shall check for newer versions [number of days].

You may set check-for-updates to 0 to disable

check-for-updates: 1 report-class: GrafanaReporter::Asciidoctor::Report templates-folder: ./templates reports-folder: ./reports report-retention: 24 webservice-port: 5050

you may want to configure the following webhook callbacks to get informed on certain events

callbacks:

all:

- <>

- ...

on_before_create:

- <>

- ...

on_after_cancel:

- <>

- ...

on_after_finish:

- <>

- ...

default-document-attributes: imagesdir: ./images



**Environment (please complete the following information):**
 - OS : FreeBSD 13.1
 - Environment : gem
 - ruby Version, if source or gem environment [e.g. 2.3.7]: ruby 2.6.8p205 (2021-07-07 revision 67951) [x86_64-freebsd13.0]
 - reporter Version [e.g. 0.3.0]: 0.5.4
divinity666 commented 2 years ago

Thanks for the detailed error report.

Could you maybe run the same with the -d DEBUG command line parameter and post the results here again? This should then include extended debug information about the process.

emanzx commented 2 years ago

here are the output with DEBUG

$ ruby-grafana-reporter -d DEBUG
I, [2022-07-04T08:16:02.098550 #2285]  INFO -- : Server listening on port 5050...
D, [2022-07-04T08:16:21.445275 #2285] DEBUG -- : Received request: GET /render?var-template=mahb_report HTTP/1.1
D, [2022-07-04T08:16:21.445413 #2285] DEBUG -- : query_parameters: {"var-template"=>["mahb_report"]}
I, [2022-07-04T08:16:21.446257 #2285]  INFO -- : Report started at 2022-07-04 08:16:21 +0000
I, [2022-07-04T08:16:21.446305 #2285]  INFO -- : You are running ruby-grafana-reporter version 0.5.4.
I, [2022-07-04T08:16:21.447360 #2285]  INFO -- : 1 report(s) in progress: 0% (running 0 secs)
D, [2022-07-04T08:16:21.472487 #2285] DEBUG -- : Document attributes: {"convert-backend"=>"pdf", "imagesdir"=>"./images", "var-template"=>"mahb_report"}
D, [2022-07-04T08:16:21.473099 #2285] DEBUG -- : Template ./templates/mahb_report.adoc contains 42 calls of grafana reporter functions.
D, [2022-07-04T08:16:21.474590 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 5, property: title)
D, [2022-07-04T08:16:21.474774 #2285] DEBUG -- : Requesting http://cm.asia.dnsvault.net:5555/api/frontend/settings with '' and timeout '60'
D, [2022-07-04T08:16:21.503022 #2285] DEBUG -- : Received response #<Net::HTTPOK:0x000000080765c598>
D, [2022-07-04T08:16:21.504019 #2285] DEBUG -- : Requesting http://cm.asia.dnsvault.net:5555/api/dashboards/uid/RzLX0d3nk with '' and timeout '60'
D, [2022-07-04T08:16:21.532750 #2285] DEBUG -- : Received response #<Net::HTTPOK:0x00000008076b3c80>
D, [2022-07-04T08:16:21.545402 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 5, property: title)
D, [2022-07-04T08:16:21.545819 #2285] DEBUG -- : Processing PanelImageBlockMacro (instance: default, dashboard: RzLX0d3nk, panel: 70)
D, [2022-07-04T08:16:21.546302 #2285] DEBUG -- : Requesting http://cm.asia.dnsvault.net:5555/render/d-solo/RzLX0d3nk?panelId=70&fullscreen=true&theme=light&timeout=60&var-template=mahb_report&from=1656922281000&to=1656922580000 with '' and timeout '60'
I, [2022-07-04T08:16:26.476376 #2285]  INFO -- : 1 report(s) in progress: 7% (running 5 secs)
D, [2022-07-04T08:16:27.127530 #2285] DEBUG -- : Received response #<Net::HTTPOK:0x0000000804b98050>
D, [2022-07-04T08:16:27.199052 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 2, property: title)
D, [2022-07-04T08:16:27.199749 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 5, property: title)
D, [2022-07-04T08:16:27.200316 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 5, property: title)
D, [2022-07-04T08:16:27.209511 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 5, property: title)
D, [2022-07-04T08:16:27.213369 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 17, property: title)
D, [2022-07-04T08:16:27.213887 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 18, property: title)
D, [2022-07-04T08:16:27.214276 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 20, property: title)
D, [2022-07-04T08:16:27.214673 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 22, property: title)
D, [2022-07-04T08:16:27.215080 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 23, property: title)
D, [2022-07-04T08:16:27.215431 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 24, property: title)
D, [2022-07-04T08:16:27.215934 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 33, property: title)
D, [2022-07-04T08:16:27.216318 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 37, property: title)
D, [2022-07-04T08:16:27.216673 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 41, property: title)
D, [2022-07-04T08:16:27.217053 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 32, property: title)
D, [2022-07-04T08:16:27.217408 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 38, property: title)
D, [2022-07-04T08:16:27.217782 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 42, property: title)
D, [2022-07-04T08:16:27.218153 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 35, property: title)
D, [2022-07-04T08:16:27.218522 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 39, property: title)
D, [2022-07-04T08:16:27.218857 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 43, property: title)
D, [2022-07-04T08:16:27.219276 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 36, property: title)
D, [2022-07-04T08:16:27.219652 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 40, property: title)
D, [2022-07-04T08:16:27.220035 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 43, property: title)
D, [2022-07-04T08:16:27.445465 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 5, property: title)
D, [2022-07-04T08:16:27.449457 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 20, property: title)
D, [2022-07-04T08:16:27.449804 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 20, property: description)
D, [2022-07-04T08:16:27.452018 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 24, property: title)
D, [2022-07-04T08:16:27.452373 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 24, property: description)
D, [2022-07-04T08:16:27.454597 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 41, property: title)
D, [2022-07-04T08:16:27.455058 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 41, property: description)
D, [2022-07-04T08:16:27.457643 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 42, property: title)
D, [2022-07-04T08:16:27.457991 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 42, property: description)
D, [2022-07-04T08:16:27.460343 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 43, property: title)
D, [2022-07-04T08:16:27.460681 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 43, property: description)
D, [2022-07-04T08:16:27.463084 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 44, property: title)
D, [2022-07-04T08:16:27.463418 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 44, property: description)
W, [2022-07-04T08:16:27.492991 #2285]  WARN -- : no rows found in table
D, [2022-07-04T08:16:27.493918 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 22, property: title)
D, [2022-07-04T08:16:27.494400 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 23, property: title)
D, [2022-07-04T08:16:27.494816 #2285] DEBUG -- : Processing PanelPropertyInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 24, property: description)
D, [2022-07-04T08:16:27.495213 #2285] DEBUG -- : Processing PanelQueryValueInlineMacro (instance: default, dashboard: RzLX0d3nk, panel: 7, query: A)
D, [2022-07-04T08:16:27.495719 #2285] DEBUG -- : Requesting http://cm.asia.dnsvault.net:5555/api/datasources/proxy/7/api/v1/query?time=1656922580000&query=sum%28netdata_system_cpu_percentage_average%7Bdimension%21%3D%22idle%22%2Cinstance%3D%22dnsvpmsg03.local%22%7D%29 with '' and timeout '60'
D, [2022-07-04T08:16:27.529721 #2285] DEBUG -- : Received response #<Net::HTTPOK:0x00000008057430d0>
E, [2022-07-04T08:16:27.530189 #2285] ERROR -- : GrafanaError: The datasource request returned with an unsupported response format (received: {"status":"success","data":{"resultType":"vector","result":[]}}). (Grafana::UnsupportedQueryResponseReceivedError)
I, [2022-07-04T08:16:27.675099 #2285]  INFO -- : Report creation ended after 6 seconds with status 'finished'
divinity666 commented 1 year ago

Okay, obviously grafana changed the call for queries from GET to POST in your grafana version.

Which version are you running?

emanzx commented 1 year ago

Sorry for late reply, currently my grafana version is 7.5.12

divinity666 commented 1 year ago

Ok, this is now the validation for my wild guess: https://grafana.com/docs/grafana/latest/whatsnew/whats-new-in-v7-5/#changed-default-http-method-for-new-prometheus-data-sources

I have this one already in my TODOs, but not yet implemented - unfortunately. I'll leave this one open til it is available as part of a next release.

divinity666 commented 1 year ago

Please try again with the just released version, which should fix the issue. Please close the issue, if it is working as expected.

divinity666 commented 1 year ago

Closing because of missing input