divinity666 / ruby-grafana-reporter

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

No pdf for Prometheus either Mysql datasource #31

Closed ttm92 closed 1 year ago

ttm92 commented 1 year ago

Describe the issue I have created a dashboard with 2 tables :

The grafana report gives me the 2 tables with one line in each. I have a link on the dashboard with allow me to call the webservice. The pdf is generated but there is no tables. For Prometheus case, I have the GrafanaError that you can see in the logs below. For mysql case, I have nothing in the pdf.

A clear and concise description of what the issue is (please provide all logs with -d DEBUG). What was the expected behaviour? Here is the log :

I, [2022-08-17T15:58:05.155184 #8]  INFO -- : Report started at 2022-08-17 15:58:05 +0000
I, [2022-08-17T15:58:05.155844 #8]  INFO -- : You are running ruby-grafana-reporter version 0.6.0.
D, [2022-08-17T15:58:05.156473 #8] DEBUG -- : Document attributes: {"convert-backend"=>"pdf", "imagesdir"=>"./images", "var-template"=>"AssetsWithoutAgent.adoc", "pdf-theme"=>"AssetsWithoutAgent", "pdf-themesdir"=>"./templates", "from"=>"now-6h", "to"=>"now", "var-date_selected"=>"2022-08-16"}
D, [2022-08-17T15:58:05.157393 #8] DEBUG -- : Template ./templates/AssetsWithoutAgent.adoc contains 4 calls of grafana reporter functions.
D, [2022-08-17T15:58:05.162194 #8] DEBUG -- : Processing PanelQueryTableIncludeProcessor (instance: default, dashboard: 9BQk2ad7kdssdz, panel: 36, query: A)
D, [2022-08-17T15:58:05.163035 #8] DEBUG -- : Requesting http://
xxx.xxx.xxx.xxx:3000/api/frontend/settings with '' and timeout '60'
D, [2022-08-17T15:58:05.205381 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007fde84d511b8>
D, [2022-08-17T15:58:05.209176 #8] DEBUG -- : Requesting http://xxx.xxx.xxx.xxx:3000/api/dashboards/uid/9BQk2ad7kdssdz with '' and timeout '60'
D, [2022-08-17T15:58:05.246464 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007fde833b45c0>
W, [2022-08-17T15:58:05.247678 #8]  WARN -- : Datasource with name default is nil, which should never happen. Check logs for details.
W, [2022-08-17T15:58:05.247814 #8]  WARN -- : Datasource with name default is nil, which should never happen. Check logs for details.
D, [2022-08-17T15:58:05.247997 #8] DEBUG -- : Requesting http://xxx.xxx.xxx.xxx:3000/api/health with '' and timeout '60'
D, [2022-08-17T15:58:05.250801 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007fde8340c900>
D, [2022-08-17T15:58:05.251142 #8] DEBUG -- : Requesting http://xxx.xxx.xxx.xxx:3000/api/ds/query with '{"from":"1660730285000","to":"1660751884000","queries":[{"datasource":{"type":"prometheus","uid":"PBFA97CFB590B2093"},"datasourceId":99,"exemplar":false,"expr":"up{job=\"node\",hostname=\"DB-RPT2\"}","format":"time_series","interval":"","metric":"","queryType":"timeSeriesQuery","refId":"A","step":15}],"range":{"raw":{"from":"now-6h","to":"now"}}}' and timeout '60'
D, [2022-08-17T15:58:05.286583 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007fde832c0718>
E, [2022-08-17T15:58:05.287068 #8] ERROR -- : GrafanaError: The datasource request returned with an unsupported response format (received: {"results":{"A":{"frames":[{"schema":{"name":"up{app=\"A2P_Messaging-PROD\", criticality=\"low\", env=\"production\", hostname=\"DB-RPT2\", instance=\"10.128.147.193:9100\", job=\"node\", org=\"Root entity\"}","refId":"A","meta":{"custom":{"resultType":"matrix"}},"fields":[{"name":"Time","type":"time","typeInfo":{"frame":"time.Time"}},{"name":"Value","type":"number","typeInfo":{"frame":"float64","nullable":true},"labels":{"__name__":"up","app":"A2P_Messaging-PROD","criticality":"low","env":"production","hostname":"DB-RPT2","instance":"xxx.xxx.xxx.yyy:9100","job":"node","org":"Root entity"},"config":{"displayNameFromDS":"up{app=\"A2P_Messaging-PROD\", criticality=\"low\", env=\"production\", hostname=\"DB-RPT2\", instance=\"xxx.xxx.xxx.yyy:9100\", job=\"node\", org=\"Root entity\"}"}}]},"data":{"values":[[1660730100000,1660730400000,1660730700000,1660731000000,1660731300000,1660731600000,1660731900000,1660732200000,1660732500000,1660732800000,1660733100000,1660733400000,1660733700000,1660734000000,1660734300000,1660734600000,1660734900000,1660735200000,1660735500000,1660735800000,1660736100000,1660736400000,1660736700000,1660737000000,1660737300000,1660737600000,1660737900000,1660738200000,1660738500000,1660738800000,1660739100000,1660739400000,1660739700000,1660740000000,1660740300000,1660740600000,1660740900000,1660741200000,1660741500000,1660741800000,1660742100000,1660742400000,1660742700000,1660743000000,1660743300000,1660743600000,1660743900000,1660744200000,1660744500000,1660744800000,1660745100000,1660745400000,1660745700000,1660746000000,1660746300000,1660746600000,1660746900000,1660747200000,1660747500000,1660747800000,1660748100000,1660748400000,1660748700000,1660749000000,1660749300000,1660749600000,1660749900000,1660750200000,1660750500000,1660750800000,1660751100000,1660751400000,1660751700000],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]]}}]}}}
). (Grafana::UnsupportedQueryResponseReceivedError)
D, [2022-08-17T15:58:05.287346 #8] DEBUG -- : Processing PanelQueryTableIncludeProcessor (instance: default, dashboard: 9BQk2ad7kdssdz, panel: 27, query: A)
W, [2022-08-17T15:58:05.287976 #8]  WARN -- : Datasource with name default is nil, which should never happen. Check logs for details.
W, [2022-08-17T15:58:05.288094 #8]  WARN -- : Datasource with name default is nil, which should never happen. Check logs for details.
D, [2022-08-17T15:58:05.288473 #8] DEBUG -- : Requesting http://xxx.xxx.xxx.xxx:3000/api/tsdb/query with '{"from":"1660730285000","to":"1660751884000","queries":[{"rawSql":"SELECT DISTINCT a.asset_id,a.asset_name,a.asset_category,a.asset_date_creation, GROUP_CONCAT(gai.asset_ipaddress,' ') as asset_ip\nFROM GLPI_asset AS a\nLEFT JOIN GLPI_asset_ipaddress AS gai ON (gai.data_date=a.data_date AND gai.asset_id=a.asset_id)\nWHERE a.asset_category IN ('Server')\nAND DATE_FORMAT(a.data_date,'%Y-%m-%d')=\"2022-08-16\"\nAND a.asset_agent_useragent IS NULL \nAND a.asset_name=\"casaaa01\"\nAND a.asset_is_an_hypervisor=\"No\" GROUP BY 1,2,3,4\nORDER BY 2 ASC","datasourceId":92,"format":"table"}]}' and timeout '60'
D, [2022-08-17T15:58:06.441913 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007fde8334dd48>
W, [2022-08-17T15:58:06.451572 #8]  WARN -- : the outline-list theme category is deprecated; use the list category instead
I, [2022-08-17T15:58:06.549543 #8]  INFO -- : Report creation ended after 1 seconds with status 'finished'

Application call

Template file (if applicable)

Environment (please complete the following information):

divinity666 commented 1 year ago

Thanks for using the reporter.

1) Regarding prometheus: this is a bug, which I could find thanks to your provided LOG details. I will release a bugfix version soon. 2) Regarging MySQL: This looks ok, from what I can see in the LOGs. The query is sent and the returned values seem to be in a proper shape. Could it be, that the query does not contain values in the requested time period ("from":"1660730285000","to":"1660751884000")?

ttm92 commented 1 year ago

Thanks for your great job and your quick answer

  1. Ok I will wait in order to test it with the new version
  2. The query is not linked to the from & to variables. I have removed the grafana variable from the query and I have as before no result. In Grafana report, I have one line as a result in the table, I have test the query "rawSql" shown in the log directly and I have one line as result too. But when I generate the pdf, there is nothing inside the pdf. I have used the line to call the function and to print the result => include::grafana_panel_query_table:27[query="A"].
    I am expecting to have the result in a raw table in pdf generated. Am I right or should I manage to print the result in a table format?

I put here the json of the grafana table :

{
  "id": 27,
  "gridPos": {
    "h": 8,
    "w": 24,
    "x": 0,
    "y": 8
  },
  "type": "table",
  "title": "Test",
  "transformations": [
    {
      "id": "organize",
      "options": {
        "excludeByName": {
          "asset_category": true,
          "asset_id": false
        },
        "indexByName": {},
        "renameByName": {
          "asset_VM_hypervisor": "VM on Hypervisor",
          "asset_date_creation": "Asset Date Creation",
          "asset_id": "Asset Id",
          "asset_ip": "Asset Ip",
          "asset_name": "Asset Name"
        }
      }
    }
  ],
  "datasource": {
    "uid": "q6orswe7z",
    "type": "mysql"
  },
  "pluginVersion": "8.3.6",
  "fieldConfig": {
    "defaults": {
      "custom": {
        "align": "center",
        "displayMode": "auto"
      },
      "thresholds": {
        "mode": "absolute",
        "steps": [
          {
            "color": "green",
            "value": null
          },
          {
            "color": "red",
            "value": 80
          }
        ]
      },
      "mappings": [],
      "color": {
        "mode": "thresholds"
      }
    },
    "overrides": [
      {
        "matcher": {
          "id": "byName",
          "options": "Asset Name"
        },
        "properties": [
          {
            "id": "custom.width"
          }
        ]
      }
    ]
  },
  "options": {
    "showHeader": true,
    "footer": {
      "show": false,
      "reducer": [
        "sum"
      ],
      "fields": ""
    },
    "sortBy": []
  },
  "targets": [
    {
      "datasource": {
        "type": "mysql",
        "uid": "q6orswe7z"
      },
      "format": "table",
      "group": [],
      "metricColumn": "none",
      "queryType": "randomWalk",
      "rawQuery": true,
      "rawSql": "SELECT DISTINCT a.asset_id,a.asset_name,a.asset_category,a.asset_date_creation, GROUP_CONCAT(gai.asset_ipaddress,' ') as asset_ip\nFROM GLPI_asset AS a\nLEFT JOIN GLPI_asset_ipaddress AS gai ON (gai.data_date=a.data_date AND gai.asset_id=a.asset_id)\nWHERE a.asset_category IN ('Server')\nAND a.asset_agent_useragent IS NULL \nAND a.asset_name=\"casaaa01\"\nAND a.asset_is_an_hypervisor=\"No\" GROUP BY 1,2,3,4\nORDER BY 2 ASC",
      "refId": "A",
      "select": [
        [
          {
            "params": [
              "id"
            ],
            "type": "column"
          }
        ]
      ],
      "table": "GLPI_asset",
      "timeColumn": "asset_date_creation",
      "timeColumnType": "timestamp",
      "where": [
        {
          "name": "$__timeFilter",
          "params": [],
          "type": "macro"
        }
      ]
    }
  ]
}

Hope this will help for the debugging.

divinity666 commented 1 year ago

Hm, having had another look on the second case, I saw, that your asciidoctor template did not frame the tables as such.

Try to modify your table is this:

:from: ${__from}
:grafana_default_dashboard: 9BQk2ad7kdssdz
:grafana_default_instance: default
:to: ${__to}
:imagesdir: "./pdf-images"
:page-interpolate: true
:fromdate: ${__from:date:YYYY-MM-DD}
#include::grafana_environment[]
#include::grafana_help[]
prometheus case
|===
include::grafana_panel_query_table:36[query="A"]
|===
mysql case
|===
include::grafana_panel_query_table:27[query="A"]
|===

I.e. you forgot the |===, see also https://docs.asciidoctor.org/asciidoc/latest/tables/build-a-basic-table/

ttm92 commented 1 year ago

I have modified the table as proposed. No changes, it still empty, I have no results in the pdf generated. Are there some constraints/rules to follow on the mysql query, as for example, is it mandatory to have the $from & $to variables used or any other variables?

divinity666 commented 1 year ago

No, there shouldn't be any constraints regarding queries.

Maybe start from a simple query, e.g. with the following:

|===
include::grafana_sql_table:92[sql="SELECT 1"]
|===

If this is working, try it again with something closer to your query.

In parallel, I am thinking about an extended debug log for a next release, which could help us as well.

Sorry for inconvenience.

ttm92 commented 1 year ago

Thanks for your support, I have implement the "SELECT 1" query in 3 different ways :

case n°1 : as proposed with

|=== include::grafana_sql_table:92[sql="SELECT 1"] |===

case n°2 : I create a new panel (id=37) with the "SELECT 1" in the query A and use grafana_panel_query_table function

|=== include::grafana_panel_query_table:37[query="A",datasource=q6orswe7z] |===

case n°3 : reuse the panel 37 and use grafana_panel_image function |=== include::grafana_panel_image:37[query="A",datasource=q6orswe7z] |===

Results in the pdf generated = case 1 => I have an error "undefined method `id' for nil:NilClass" case 2 => I have a cell which is empty, no data as before case 3 => I have an image with 1 in the title and 1 in the result cell.

Here is the log, hope it will help :

I, [2022-08-30T16:07:33.300754 #8]  INFO -- : Report started at 2022-08-30 16:07:33 +0000
I, [2022-08-30T16:07:33.301430 #8]  INFO -- : You are running ruby-grafana-reporter version 0.6.0.
D, [2022-08-30T16:07:33.301807 #8] DEBUG -- : Document attributes: {"convert-backend"=>"pdf", "imagesdir"=>"./images", "var-template"=>"AssetsWithoutAgent.adoc", "pdf-theme"=>"AssetsWithoutAgent", "pdf-themesdir"=>"./templates", "from"=>"now-6h", "to"=>"now", "var-date_selected"=>"2021-09-28"}
D, [2022-08-30T16:07:33.302334 #8] DEBUG -- : Template ./templates/AssetsWithoutAgent.adoc contains 3 calls of grafana reporter functions.
D, [2022-08-30T16:07:33.308296 #8] DEBUG -- : Processing SqlTableIncludeProcessor (instance: default, datasource: 92, sql: SELECT 1)
D, [2022-08-30T16:07:33.309733 #8] DEBUG -- : Requesting http://xxx.xxx.xxx.xxx:3000/api/frontend/settings with '' and timeout '60'
D, [2022-08-30T16:07:33.347274 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007fde8230b3b8>
F, [2022-08-30T16:07:33.356457 #8] FATAL -- : undefined method `id' for nil:NilClass

      datasource = @datasources.select { |_name, ds| ds.id == datasource_id.to_i }.values.first
                                                       ^^^
D, [2022-08-30T16:07:33.358828 #8] DEBUG -- : Processing PanelQueryTableIncludeProcessor (instance: default, dashboard: 9BQk2ad7kdssdz, panel: 37, query: A)
D, [2022-08-30T16:07:33.359020 #8] DEBUG -- : Requesting http://xxx.xxx.xxx.xxx:3000/api/dashboards/uid/9BQk2ad7kdssdz with '' and timeout '60'
D, [2022-08-30T16:07:33.396092 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007fde822555e0>
W, [2022-08-30T16:07:33.397521 #8]  WARN -- : Datasource with name default is nil, which should never happen. Check logs for details.
W, [2022-08-30T16:07:33.397658 #8]  WARN -- : Datasource with name default is nil, which should never happen. Check logs for details.
D, [2022-08-30T16:07:33.397884 #8] DEBUG -- : Requesting http://xxx.xxx.xxx.xxx:3000/api/health with '' and timeout '60'
D, [2022-08-30T16:07:33.400704 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007fde82260f08>
D, [2022-08-30T16:07:33.401031 #8] DEBUG -- : Requesting http://1xxx.xxx.xxx.xxx:3000/api/tsdb/query with '{"from":"1661854053000","to":"1661875652000","queries":[{"rawSql":"SELECT 1","datasourceId":92,"format":"table"}]}' and timeout '60'
D, [2022-08-30T16:07:33.433032 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007fde822268a8>
W, [2022-08-30T16:07:33.433627 #8]  WARN -- : AssetsWithoutAgent.adoc: line 23: unterminated table block
D, [2022-08-30T16:07:33.476325 #8] DEBUG -- : Processing PanelImageInlineMacro (instance: default, dashboard: 9BQk2ad7kdssdz, panel: 37)
D, [2022-08-30T16:07:33.477288 #8] DEBUG -- : Requesting http://1xxx.xxx.xxx.xxx:3000/render/d-solo/9BQk2ad7kdssdz?panelId=37&fullscreen=true&theme=light&timeout=60&var-date_selected=2021-09-28&var-template=AssetsWithoutAgent.adoc&from=1661854053000&to=1661875652000 with '' and timeout '60'
divinity666 commented 1 year ago

I just released a new version, which should solve your first issue and help us with the second.

Please add verbose_log="true" in your template, like so:

prometheus case
|===
include::grafana_panel_query_table:36[query="A",verbose_log="true"]
|===
mysql case
|===
include::grafana_panel_query_table:27[query="A",verbose_log="true"]
|===

and post the full logs (you may x-out private data).

Thanks for staying tuned.

ttm92 commented 1 year ago

I have update the version and put the verbose log to true. Here are the logs :

I, [2022-09-01T07:19:09.999760 #8]  INFO -- : Report started at 2022-09-01 07:19:09 +0000
I, [2022-09-01T07:19:09.999989 #8]  INFO -- : You are running ruby-grafana-reporter version 0.6.1.
D, [2022-09-01T07:19:10.000116 #8] DEBUG -- : Document attributes: {"convert-backend"=>"pdf", "imagesdir"=>"./images", "var-template"=>"AssetsWithoutAgent.adoc", "pdf-theme"=>"AssetsWithoutAgent", "pdf-themesdir"=>"./templates", "from"=>"now-6h", "to"=>"now", "var-date_selected"=>"2021-09-28"}
D, [2022-09-01T07:19:10.000322 #8] DEBUG -- : Template ./templates/AssetsWithoutAgent.adoc contains 3 calls of grafana reporter functions.
D, [2022-09-01T07:19:10.001665 #8] DEBUG -- : Processing SqlTableIncludeProcessor (instance: default, datasource: 92, sql: SELECT 1)
D, [2022-09-01T07:19:10.002147 #8] DEBUG -- : Requesting http://xxx.xxx.xxx.xxx:xxx/api/frontend/settings with '' and timeout '60'
D, [2022-09-01T07:19:10.034251 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007efe15f0e230>
F, [2022-09-01T07:19:10.041548 #8] FATAL -- : undefined method `id' for nil:NilClass
D, [2022-09-01T07:19:10.042186 #8] DEBUG -- : Processing PanelQueryTableIncludeProcessor (instance: default, dashboard: 9BQk2ad7kdssdz, panel: 37, query: A)
D, [2022-09-01T07:19:10.042345 #8] DEBUG -- : Requesting http://xxx.xxx.xxx.xxx:xxx/api/dashboards/uid/9BQk2ad7kdssdz with '' and timeout '60'
D, [2022-09-01T07:19:10.074376 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007efe16383338>
W, [2022-09-01T07:19:10.075620 #8]  WARN -- : Datasource with name default is nil, which should never happen. Check logs for details.
W, [2022-09-01T07:19:10.075744 #8]  WARN -- : Datasource with name default is nil, which should never happen. Check logs for details.
D, [2022-09-01T07:19:10.075929 #8] DEBUG -- : Requesting http://xxx.xxx.xxx.xxx:xxx/api/health with '' and timeout '60'
D, [2022-09-01T07:19:10.078864 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007efe163430a8>
D, [2022-09-01T07:19:10.079155 #8] DEBUG -- : Requesting http://xxx.xxx.xxx.xxx:xxx/api/tsdb/query with '{"from":"1661995150000","to":"1662016749000","queries":[{"rawSql":"SELECT 1","datasourceId":92,"format":"table"}]}' and timeout '60'
D, [2022-09-01T07:19:10.108149 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007efe16313a60>
D, [2022-09-01T07:19:10.108299 #8] DEBUG -- : Raw result: {:header=>[], :content=>[]}
D, [2022-09-01T07:19:10.108383 #8] DEBUG -- : Formatted result: 
W, [2022-09-01T07:19:10.131139 #8]  WARN -- : no rows found in table
D, [2022-09-01T07:19:10.133491 #8] DEBUG -- : Processing PanelImageInlineMacro (instance: default, dashboard: 9BQk2ad7kdssdz, panel: 37)
D, [2022-09-01T07:19:10.134317 #8] DEBUG -- : Requesting http://xxx.xxx.xxx.xxx:xxx/render/d-solo/9BQk2ad7kdssdz?panelId=37&fullscreen=true&theme=light&timeout=60&var-date_selected=2021-09-28&var-template=AssetsWithoutAgent.adoc&from=1661995150000&to=1662016749000 with '' and timeout '60'
D, [2022-09-01T07:19:13.743038 #8] DEBUG -- : Received response #<Net::HTTPOK:0x00007efe175fe9b8>
I, [2022-09-01T07:19:14.142682 #8]  INFO -- : Report creation ended after 5 seconds with status 'died'

In the render, I have also this error which is showed :

Prawn::Errors::CannotFit
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/line_wrap.rb:248:in `update_output_based_on_last_fragment'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/line_wrap.rb:231:in `fragment_finished'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/line_wrap.rb:117:in `block in add_fragment_to_line'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/line_wrap.rb:96:in `each'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/line_wrap.rb:96:in `add_fragment_to_line'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/line_wrap.rb:80:in `block in apply_font_settings_and_add_fragment_to_line'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/font.rb:100:in `font_size'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-pdf-1.6.2/lib/asciidoctor/pdf/ext/prawn/extensions.rb:286:in `font_size'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/arranger.rb:274:in `apply_font_size'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/arranger.rb:193:in `block in apply_font_settings'
/usr/lib/ruby/gems/2.7.0/gems/pdf-core-0.9.0/lib/pdf/core/text.rb:231:in `character_spacing'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/arranger.rb:183:in `apply_font_settings'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/line_wrap.rb:79:in `apply_font_settings_and_add_fragment_to_line'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/line_wrap.rb:49:in `wrap_line'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/wrap.rb:55:in `wrap'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-pdf-1.6.2/lib/asciidoctor/pdf/formatted_text/inline_image_arranger.rb:12:in `wrap'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/box.rb:229:in `block (4 levels) in render'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/font.rb:100:in `font_size'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-pdf-1.6.2/lib/asciidoctor/pdf/ext/prawn/extensions.rb:286:in `font_size'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/box.rb:221:in `block (3 levels) in render'
/usr/lib/ruby/gems/2.7.0/gems/prawn-templates-0.1.2/lib/prawn/text.rb:19:in `text_rendering_mode'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/box.rb:216:in `block (2 levels) in render'
/usr/lib/ruby/gems/2.7.0/gems/pdf-core-0.9.0/lib/pdf/core/text.rb:227:in `character_spacing'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/box.rb:215:in `block in render'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/font.rb:214:in `save_font'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/text/formatted/box.rb:214:in `render'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table/cell/text.rb:60:in `block in natural_content_height'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table/cell/text.rb:99:in `block in with_font'
/usr/lib/ruby/gems/2.7.0/gems/prawn-2.4.0/lib/prawn/font.rb:214:in `save_font'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table/cell/text.rb:92:in `with_font'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table/cell/text.rb:58:in `natural_content_height'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:336:in `content_height'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:309:in `height_ignoring_span'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table/cell.rb:317:in `height'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table.rb:373:in `block in row_heights'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table.rb:369:in `each'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table.rb:369:in `row_heights'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table.rb:656:in `set_row_heights'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table.rb:148:in `initialize'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table.rb:111:in `new'
/usr/lib/ruby/gems/2.7.0/gems/prawn-table-0.2.2/lib/prawn/table.rb:111:in `table'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-pdf-1.6.2/lib/asciidoctor/pdf/converter.rb:2168:in `convert_table'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-pdf-1.6.2/lib/asciidoctor/pdf/converter.rb:135:in `convert'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-2.0.16/lib/asciidoctor/abstract_block.rb:75:in `convert'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-2.0.16/lib/asciidoctor/abstract_block.rb:84:in `block in content'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-2.0.16/lib/asciidoctor/abstract_block.rb:84:in `map'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-2.0.16/lib/asciidoctor/abstract_block.rb:84:in `content'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-2.0.16/lib/asciidoctor/document.rb:998:in `content'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-pdf-1.6.2/lib/asciidoctor/pdf/converter.rb:152:in `traverse'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-pdf-1.6.2/lib/asciidoctor/pdf/converter.rb:261:in `block in convert_document'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-pdf-1.6.2/lib/asciidoctor/pdf/converter.rb:594:in `indent_section'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-pdf-1.6.2/lib/asciidoctor/pdf/converter.rb:208:in `convert_document'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-pdf-1.6.2/lib/asciidoctor/pdf/converter.rb:135:in `convert'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-2.0.16/lib/asciidoctor/document.rb:948:in `convert'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-2.0.16/lib/asciidoctor/convert.rb:118:in `convert'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-2.0.16/lib/asciidoctor/convert.rb:190:in `block in convert_file'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-2.0.16/lib/asciidoctor/convert.rb:190:in `open'
/usr/lib/ruby/gems/2.7.0/gems/asciidoctor-2.0.16/lib/asciidoctor/convert.rb:190:in `convert_file'
/documents/lib/grafana_reporter/asciidoctor/report.rb:41:in `build'
/documents/lib/grafana_reporter/abstract_report.rb:148:in `create_report'
/documents/lib/grafana_reporter/application/webservice.rb:221:in `block in render_report'

Hope it helps

divinity666 commented 1 year ago

Ok, by any reason (which we are after :-)) the SQL query does not return results to the reporter. And that is why no results are shown. The second error is most likely only a result of the first error.

Let's now track, what grafana in detail sends to which endpoint. Therefore please do the following:

1) Open the inspect query window: image

1a) Open DevTools (in most browsers with F12) (optional)

2) Hit the refresh button image

2a) Copy the request from the DevTools as cURL and post it here (optional)

3) Copy the results to the clipboard image

4) Post at least the results section and the first response items here.

Thanks

ttm92 commented 1 year ago

Please find the results "copy to clipboard". Hope it will help, let me know if you need any other result Many thanks

{
  "request": {
    "url": "api/ds/query",
    "method": "POST",
    "data": {
      "queries": [
        {
          "refId": "A",
          "datasource": {
            "uid": "q6orswe7z",
            "type": "mysql"
          },
          "rawSql": "SELECT 1",
          "format": "table",
          "datasourceId": 92,
          "intervalMs": 60000,
          "maxDataPoints": 1680
        }
      ],
      "range": {
        "from": "2022-09-06T11:00:40.995Z",
        "to": "2022-09-06T17:00:40.995Z",
        "raw": {
          "from": "now-6h",
          "to": "now"
        }
      },
      "from": "1662462040995",
      "to": "1662483640995"
    },
    "hideFromInspector": false
  },
  "response": {
    "results": {
      "A": {
        "frames": [
          {
            "schema": {
              "refId": "A",
              "meta": {
                "executedQueryString": "SELECT 1",
                "transformations": [
                  "organize"
                ]
              },
              "fields": [
                {
                  "name": "1",
                  "type": "number",
                  "typeInfo": {
                    "frame": "int64",
                    "nullable": true
                  }
                }
              ]
            },
            "data": {
              "values": [
                [
                  1
                ]
              ]
            }
          }
        ],
        "refId": "A"
      }
    }
  }
}
divinity666 commented 1 year ago

Ok, this now shows the issue: the SQL datasource uses a new endpoint. I need to figure out with which version this happened and then I will provide an update.

Stay tuned.

divinity666 commented 1 year ago

I just released a new release, which should also fix the SQL database issue. Please try it out.

divinity666 commented 1 year ago

Closing because of missing input