ruby-grafana-reporter 0.1.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +0 -0
  3. data/README.md +95 -173
  4. data/bin/ruby-grafana-reporter +5 -0
  5. data/lib/VERSION.rb +5 -3
  6. data/lib/grafana/abstract_panel_query.rb +22 -20
  7. data/lib/grafana/abstract_query.rb +132 -127
  8. data/lib/grafana/abstract_sql_query.rb +51 -42
  9. data/lib/grafana/dashboard.rb +77 -66
  10. data/lib/grafana/errors.rb +66 -61
  11. data/lib/grafana/grafana.rb +133 -131
  12. data/lib/grafana/panel.rb +41 -39
  13. data/lib/grafana/panel_image_query.rb +52 -49
  14. data/lib/grafana/variable.rb +217 -259
  15. data/lib/grafana_reporter/abstract_report.rb +112 -109
  16. data/lib/grafana_reporter/application/application.rb +158 -229
  17. data/lib/grafana_reporter/application/errors.rb +33 -30
  18. data/lib/grafana_reporter/application/webservice.rb +230 -0
  19. data/lib/grafana_reporter/asciidoctor/alerts_table_query.rb +101 -99
  20. data/lib/grafana_reporter/asciidoctor/annotations_table_query.rb +96 -96
  21. data/lib/grafana_reporter/asciidoctor/errors.rb +40 -37
  22. data/lib/grafana_reporter/asciidoctor/extensions/alerts_table_include_processor.rb +92 -86
  23. data/lib/grafana_reporter/asciidoctor/extensions/annotations_table_include_processor.rb +91 -86
  24. data/lib/grafana_reporter/asciidoctor/extensions/panel_image_block_macro.rb +69 -67
  25. data/lib/grafana_reporter/asciidoctor/extensions/panel_image_inline_macro.rb +68 -65
  26. data/lib/grafana_reporter/asciidoctor/extensions/panel_property_inline_macro.rb +61 -58
  27. data/lib/grafana_reporter/asciidoctor/extensions/panel_query_table_include_processor.rb +78 -75
  28. data/lib/grafana_reporter/asciidoctor/extensions/panel_query_value_inline_macro.rb +73 -70
  29. data/lib/grafana_reporter/asciidoctor/extensions/processor_mixin.rb +20 -18
  30. data/lib/grafana_reporter/asciidoctor/extensions/show_environment_include_processor.rb +43 -41
  31. data/lib/grafana_reporter/asciidoctor/extensions/show_help_include_processor.rb +30 -202
  32. data/lib/grafana_reporter/asciidoctor/extensions/sql_table_include_processor.rb +70 -67
  33. data/lib/grafana_reporter/asciidoctor/extensions/sql_value_inline_macro.rb +66 -65
  34. data/lib/grafana_reporter/asciidoctor/extensions/value_as_variable_include_processor.rb +88 -57
  35. data/lib/grafana_reporter/asciidoctor/help.rb +435 -0
  36. data/lib/grafana_reporter/asciidoctor/panel_first_value_query.rb +36 -32
  37. data/lib/grafana_reporter/asciidoctor/panel_image_query.rb +28 -23
  38. data/lib/grafana_reporter/asciidoctor/panel_property_query.rb +44 -43
  39. data/lib/grafana_reporter/asciidoctor/panel_table_query.rb +40 -36
  40. data/lib/grafana_reporter/asciidoctor/query_mixin.rb +312 -309
  41. data/lib/grafana_reporter/asciidoctor/report.rb +179 -159
  42. data/lib/grafana_reporter/asciidoctor/sql_first_value_query.rb +42 -34
  43. data/lib/grafana_reporter/asciidoctor/sql_table_query.rb +44 -32
  44. data/lib/grafana_reporter/configuration.rb +304 -326
  45. data/lib/grafana_reporter/console_configuration_wizard.rb +269 -0
  46. data/lib/grafana_reporter/errors.rb +48 -38
  47. data/lib/grafana_reporter/logger/two_way_logger.rb +58 -52
  48. data/lib/ruby-grafana-reporter.rb +32 -27
  49. metadata +116 -16
@@ -1,67 +1,69 @@
1
- require_relative 'processor_mixin'
2
-
3
- module GrafanaReporter
4
- module Asciidoctor
5
- module Extensions
6
- # Implements the hook
7
- # grafana_panel_image::<panel_id>[<options>]
8
- #
9
- # Stores the queried panel as a temporary image file and returns an asciidoctor link
10
- # to be included in the report.
11
- #
12
- # == Used document parameters
13
- # +grafana_default_instance+ - name of grafana instance, 'default' if not specified
14
- #
15
- # +grafana_default_dashboard+ - uid of grafana default dashboard to use
16
- #
17
- # +from+ - 'from' time for the sql query
18
- #
19
- # +to+ - 'to' time for the sql query
20
- #
21
- # == Supported options
22
- # +field+ - property to query for, e.g. +description+ or +title+ (*mandatory*)
23
- #
24
- # +instance+ - name of grafana instance, 'default' if not specified
25
- #
26
- # +dashboard+ - uid of grafana dashboard to use
27
- #
28
- # +from+ - 'from' time for the sql query
29
- #
30
- # +to+ - 'to' time for the sql query
31
- class PanelImageBlockMacro < ::Asciidoctor::Extensions::BlockMacroProcessor
32
- include ProcessorMixin
33
- use_dsl
34
-
35
- named :grafana_panel_image
36
-
37
- # :nodoc:
38
- def process(parent, target, attrs)
39
- return if @report.cancel
40
-
41
- @report.next_step
42
- instance = attrs['instance'] || parent.document.attr('grafana_default_instance') || 'default'
43
- dashboard = attrs['dashboard'] || parent.document.attr('grafana_default_dashboard')
44
- @report.logger.debug("Processing PanelImageBlockMacro (instance: #{instance}, dashboard: #{dashboard}, panel: #{target})")
45
- query = PanelImageQuery.new(@report.grafana(instance).dashboard(dashboard).panel(target))
46
- query.merge_hash_variables(parent.document.attributes, attrs)
47
- @report.logger.debug("from: #{query.from}, to: #{query.to}")
48
-
49
- begin
50
- image = query.execute(@report.grafana(instance))
51
- image_path = @report.save_image_file(image)
52
- rescue GrafanaReporterError => e
53
- @report.logger.error(e.message)
54
- return create_paragraph(parent, e.message, attrs)
55
- rescue StandardError => e
56
- @report.logger.fatal(e.message)
57
- return create_paragraph(parent, e.message, attrs)
58
- end
59
-
60
- attrs['target'] = image_path
61
- block = create_image_block(parent, attrs)
62
- block
63
- end
64
- end
65
- end
66
- end
67
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'processor_mixin'
4
+
5
+ module GrafanaReporter
6
+ module Asciidoctor
7
+ module Extensions
8
+ # Implements the hook
9
+ # grafana_panel_image::<panel_id>[<options>]
10
+ #
11
+ # Stores the queried panel as a temporary image file and returns an asciidoctor link
12
+ # to be included in the report.
13
+ #
14
+ # == Used document parameters
15
+ # +grafana_default_instance+ - name of grafana instance, 'default' if not specified
16
+ #
17
+ # +grafana_default_dashboard+ - uid of grafana default dashboard to use
18
+ #
19
+ # +from+ - 'from' time for the sql query
20
+ #
21
+ # +to+ - 'to' time for the sql query
22
+ #
23
+ # == Supported options
24
+ # +field+ - property to query for, e.g. +description+ or +title+ (*mandatory*)
25
+ #
26
+ # +instance+ - name of grafana instance, 'default' if not specified
27
+ #
28
+ # +dashboard+ - uid of grafana dashboard to use
29
+ #
30
+ # +from+ - 'from' time for the sql query
31
+ #
32
+ # +to+ - 'to' time for the sql query
33
+ class PanelImageBlockMacro < ::Asciidoctor::Extensions::BlockMacroProcessor
34
+ include ProcessorMixin
35
+ use_dsl
36
+
37
+ named :grafana_panel_image
38
+
39
+ # :nodoc:
40
+ def process(parent, target, attrs)
41
+ return if @report.cancel
42
+
43
+ @report.next_step
44
+ instance = attrs['instance'] || parent.document.attr('grafana_default_instance') || 'default'
45
+ dashboard = attrs['dashboard'] || parent.document.attr('grafana_default_dashboard')
46
+ @report.logger.debug("Processing PanelImageBlockMacro (instance: #{instance}, dashboard: #{dashboard},"\
47
+ " panel: #{target})")
48
+ query = PanelImageQuery.new(@report.grafana(instance).dashboard(dashboard).panel(target))
49
+ query.merge_hash_variables(parent.document.attributes, attrs)
50
+ @report.logger.debug("from: #{query.from}, to: #{query.to}")
51
+
52
+ begin
53
+ image = query.execute(@report.grafana(instance))
54
+ image_path = @report.save_image_file(image)
55
+ rescue GrafanaReporterError => e
56
+ @report.logger.error(e.message)
57
+ return create_paragraph(parent, e.message, attrs)
58
+ rescue StandardError => e
59
+ @report.logger.fatal(e.message)
60
+ return create_paragraph(parent, e.message, attrs)
61
+ end
62
+
63
+ attrs['target'] = image_path
64
+ create_image_block(parent, attrs)
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -1,65 +1,68 @@
1
- require_relative 'processor_mixin'
2
-
3
- module GrafanaReporter
4
- module Asciidoctor
5
- module Extensions
6
- # Implements the hook
7
- # grafana_panel_image:<panel_id>[<options>]
8
- #
9
- # Stores the queried panel as a temporary image file and returns an asciidoctor link
10
- # to be included in the report.
11
- #
12
- # == Used document parameters
13
- # +grafana_default_instance+ - name of grafana instance, 'default' if not specified
14
- #
15
- # +grafana_default_dashboard+ - uid of grafana default dashboard to use
16
- #
17
- # +from+ - 'from' time for the sql query
18
- #
19
- # +to+ - 'to' time for the sql query
20
- #
21
- # == Supported options
22
- # +field+ - property to query for, e.g. +description+ or +title+ (*mandatory*)
23
- #
24
- # +instance+ - name of grafana instance, 'default' if not specified
25
- #
26
- # +dashboard+ - uid of grafana dashboard to use
27
- #
28
- # +from+ - 'from' time for the sql query
29
- #
30
- # +to+ - 'to' time for the sql query
31
- class PanelImageInlineMacro < ::Asciidoctor::Extensions::InlineMacroProcessor
32
- include ProcessorMixin
33
- use_dsl
34
-
35
- named :grafana_panel_image
36
-
37
- # :nodoc:
38
- def process(parent, target, attrs)
39
- return if @report.cancel
40
-
41
- @report.next_step
42
- instance = attrs['instance'] || parent.document.attr('grafana_default_instance') || 'default'
43
- dashboard = attrs['dashboard'] || parent.document.attr('grafana_default_dashboard')
44
- @report.logger.debug("Processing PanelImageInlineMacro (instance: #{instance}, dashboard: #{dashboard}, panel: #{target})")
45
- query = PanelImageQuery.new(@report.grafana(instance).dashboard(dashboard).panel(target))
46
- query.merge_hash_variables(parent.document.attributes, attrs)
47
- @report.logger.debug("from: #{query.from}, to: #{query.to}")
48
-
49
- begin
50
- image = query.execute(@report.grafana(instance))
51
- image_path = @report.save_image_file(image)
52
- rescue GrafanaReporterError => e
53
- @report.logger.error(e.message)
54
- return create_inline(parent, :quoted, e.message)
55
- rescue StandardError => e
56
- @report.logger.fatal(e.message)
57
- return create_inline(parent, :quoted, e.message)
58
- end
59
-
60
- create_inline(parent, :image, nil, { target: image_path, attributes: attrs })
61
- end
62
- end
63
- end
64
- end
65
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'processor_mixin'
4
+
5
+ module GrafanaReporter
6
+ module Asciidoctor
7
+ module Extensions
8
+ # Implements the hook
9
+ # grafana_panel_image:<panel_id>[<options>]
10
+ #
11
+ # Stores the queried panel as a temporary image file and returns an asciidoctor link
12
+ # to be included in the report.
13
+ #
14
+ # == Used document parameters
15
+ # +grafana_default_instance+ - name of grafana instance, 'default' if not specified
16
+ #
17
+ # +grafana_default_dashboard+ - uid of grafana default dashboard to use
18
+ #
19
+ # +from+ - 'from' time for the sql query
20
+ #
21
+ # +to+ - 'to' time for the sql query
22
+ #
23
+ # == Supported options
24
+ # +field+ - property to query for, e.g. +description+ or +title+ (*mandatory*)
25
+ #
26
+ # +instance+ - name of grafana instance, 'default' if not specified
27
+ #
28
+ # +dashboard+ - uid of grafana dashboard to use
29
+ #
30
+ # +from+ - 'from' time for the sql query
31
+ #
32
+ # +to+ - 'to' time for the sql query
33
+ class PanelImageInlineMacro < ::Asciidoctor::Extensions::InlineMacroProcessor
34
+ include ProcessorMixin
35
+ use_dsl
36
+
37
+ named :grafana_panel_image
38
+
39
+ # :nodoc:
40
+ def process(parent, target, attrs)
41
+ return if @report.cancel
42
+
43
+ @report.next_step
44
+ instance = attrs['instance'] || parent.document.attr('grafana_default_instance') || 'default'
45
+ dashboard = attrs['dashboard'] || parent.document.attr('grafana_default_dashboard')
46
+ @report.logger.debug("Processing PanelImageInlineMacro (instance: #{instance}, dashboard: #{dashboard},"\
47
+ " panel: #{target})")
48
+ query = PanelImageQuery.new(@report.grafana(instance).dashboard(dashboard).panel(target))
49
+ query.merge_hash_variables(parent.document.attributes, attrs)
50
+ @report.logger.debug("from: #{query.from}, to: #{query.to}")
51
+
52
+ begin
53
+ image = query.execute(@report.grafana(instance))
54
+ image_path = @report.save_image_file(image)
55
+ rescue GrafanaReporterError => e
56
+ @report.logger.error(e.message)
57
+ return create_inline(parent, :quoted, e.message)
58
+ rescue StandardError => e
59
+ @report.logger.fatal(e.message)
60
+ return create_inline(parent, :quoted, e.message)
61
+ end
62
+
63
+ create_inline(parent, :image, nil, { target: image_path, attributes: attrs })
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
@@ -1,58 +1,61 @@
1
- require_relative 'processor_mixin'
2
-
3
- module GrafanaReporter
4
- module Asciidoctor
5
- module Extensions
6
- # Implements the hook
7
- # grafana_panel_property:<panel_id>[<options>]
8
- #
9
- # Returns the requested panel property.
10
- #
11
- # == Used document parameters
12
- # +grafana_default_instance+ - name of grafana instance, 'default' if not specified
13
- #
14
- # +grafana_default_dashboard+ - uid of grafana default dashboard to use
15
- #
16
- # == Supported options
17
- # +field+ - property to query for, e.g. +description+ or +title+ (*mandatory*)
18
- #
19
- # +instance+ - name of grafana instance, 'default' if not specified
20
- #
21
- # +dashboard+ - uid of grafana dashboard to use
22
- class PanelPropertyInlineMacro < ::Asciidoctor::Extensions::InlineMacroProcessor
23
- include ProcessorMixin
24
- use_dsl
25
-
26
- named :grafana_panel_property
27
- name_positional_attributes :field
28
-
29
- # :nodoc:
30
- def process(parent, target, attrs)
31
- return if @report.cancel
32
-
33
- @report.next_step
34
- instance = attrs['instance'] || parent.document.attr('grafana_default_instance') || 'default'
35
- dashboard = attrs['dashboard'] || parent.document.attr('grafana_default_dashboard')
36
- @report.logger.debug("Processing PanelPropertyInlineMacro (instance: #{instance}, dashboard: #{dashboard}, panel: #{target}, property: #{attrs[:field]})")
37
- query = PanelPropertyQuery.new(@report.grafana(instance).dashboard(dashboard).panel(target), attrs[:field])
38
- query.merge_hash_variables(parent.document.attributes, attrs)
39
- @report.logger.debug("from: #{query.from}, to: #{query.to}")
40
-
41
- begin
42
- description = query.execute(@report.grafana(instance))
43
- rescue GrafanaReporterError => e
44
- @report.logger.error(e.message)
45
- return create_inline(parent, :quoted, e.message)
46
- rescue StandardError => e
47
- @report.logger.fatal(e.message)
48
- return create_inline(parent, :quoted, e.message)
49
- end
50
-
51
- # translate linebreaks to asciidoctor syntax
52
- # and HTML encode to make sure, that HTML formattings are respected
53
- create_inline(parent, :quoted, CGI.escapeHTML(description.gsub(%r{//[^\n]*(?:\n)?}, '').gsub(/\n/, " +\n")))
54
- end
55
- end
56
- end
57
- end
58
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'processor_mixin'
4
+
5
+ module GrafanaReporter
6
+ module Asciidoctor
7
+ module Extensions
8
+ # Implements the hook
9
+ # grafana_panel_property:<panel_id>[<options>]
10
+ #
11
+ # Returns the requested panel property.
12
+ #
13
+ # == Used document parameters
14
+ # +grafana_default_instance+ - name of grafana instance, 'default' if not specified
15
+ #
16
+ # +grafana_default_dashboard+ - uid of grafana default dashboard to use
17
+ #
18
+ # == Supported options
19
+ # +field+ - property to query for, e.g. +description+ or +title+ (*mandatory*)
20
+ #
21
+ # +instance+ - name of grafana instance, 'default' if not specified
22
+ #
23
+ # +dashboard+ - uid of grafana dashboard to use
24
+ class PanelPropertyInlineMacro < ::Asciidoctor::Extensions::InlineMacroProcessor
25
+ include ProcessorMixin
26
+ use_dsl
27
+
28
+ named :grafana_panel_property
29
+ name_positional_attributes :field
30
+
31
+ # :nodoc:
32
+ def process(parent, target, attrs)
33
+ return if @report.cancel
34
+
35
+ @report.next_step
36
+ instance = attrs['instance'] || parent.document.attr('grafana_default_instance') || 'default'
37
+ dashboard = attrs['dashboard'] || parent.document.attr('grafana_default_dashboard')
38
+ @report.logger.debug("Processing PanelPropertyInlineMacro (instance: #{instance}, dashboard: #{dashboard},"\
39
+ " panel: #{target}, property: #{attrs[:field]})")
40
+ query = PanelPropertyQuery.new(@report.grafana(instance).dashboard(dashboard).panel(target), attrs[:field])
41
+ query.merge_hash_variables(parent.document.attributes, attrs)
42
+ @report.logger.debug("from: #{query.from}, to: #{query.to}")
43
+
44
+ begin
45
+ description = query.execute(@report.grafana(instance))
46
+ rescue GrafanaReporterError => e
47
+ @report.logger.error(e.message)
48
+ return create_inline(parent, :quoted, e.message)
49
+ rescue StandardError => e
50
+ @report.logger.fatal(e.message)
51
+ return create_inline(parent, :quoted, e.message)
52
+ end
53
+
54
+ # translate linebreaks to asciidoctor syntax
55
+ # and HTML encode to make sure, that HTML formattings are respected
56
+ create_inline(parent, :quoted, CGI.escapeHTML(description.gsub(%r{//[^\n]*(?:\n)?}, '').gsub(/\n/, " +\n")))
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -1,75 +1,78 @@
1
- require_relative 'processor_mixin'
2
-
3
- module GrafanaReporter
4
- module Asciidoctor
5
- module Extensions
6
- # Implements the hook
7
- # include::grafana_panel_query_table:<panel_id>[<options>]
8
- #
9
- # Returns the results of the SQL query as a asciidoctor table.
10
- #
11
- # == Used document parameters
12
- # +grafana_default_instance+ - name of grafana instance, 'default' if not specified
13
- #
14
- # +grafana_default_dashboard+ - uid of grafana default dashboard to use
15
- #
16
- # +from+ - 'from' time for the sql query
17
- #
18
- # +to+ - 'to' time for the sql query
19
- #
20
- # All other variables starting with +var-+ will be used to replace grafana templating strings
21
- # in the given SQL query.
22
- #
23
- # == Supported options
24
- # +query+ - query letter, which shall be used, e.g. +C+ (*mandatory*)
25
- #
26
- # +instance+ - name of grafana instance, 'default' if not specified
27
- #
28
- # +dashboard+ - uid of grafana dashboard to use
29
- #
30
- # +from+ - 'from' time for the sql query
31
- #
32
- # +to+ - 'to' time for the sql query
33
- #
34
- # +format+ - see {QueryMixin#format_columns}
35
- #
36
- # +replace_values+ - see {QueryMixin#replace_values}
37
- #
38
- # +filter_columns+ - see {QueryMixin#filter_columns}
39
- class PanelQueryTableIncludeProcessor < ::Asciidoctor::Extensions::IncludeProcessor
40
- include ProcessorMixin
41
-
42
- # :nodoc:
43
- def handles?(target)
44
- target.start_with? 'grafana_panel_query_table:'
45
- end
46
-
47
- # :nodoc:
48
- def process(doc, reader, target, attrs)
49
- return if @report.cancel
50
-
51
- @report.next_step
52
- panel_id = target.split(':')[1]
53
- instance = attrs['instance'] || doc.attr('grafana_default_instance') || 'default'
54
- dashboard = attrs['dashboard'] || doc.attr('grafana_default_dashboard')
55
- @report.logger.debug("Processing PanelQueryTableIncludeProcessor (instance: #{instance}, dashboard: #{dashboard}, panel: #{panel_id}, query: #{attrs['query']})")
56
- query = PanelTableQuery.new(@report.grafana(instance).dashboard(dashboard).panel(panel_id), attrs['query'])
57
- query.merge_hash_variables(doc.attributes, attrs)
58
- @report.logger.debug("from: #{query.from}, to: #{query.to}")
59
-
60
- begin
61
- reader.unshift_lines query.execute(@report.grafana(instance))
62
- rescue GrafanaReporterError => e
63
- @report.logger.error(e.message)
64
- reader.unshift_line '|' + e.message
65
- rescue StandardError => e
66
- @report.logger.fatal(e.message)
67
- reader.unshift_line '|' + e.message
68
- end
69
-
70
- reader
71
- end
72
- end
73
- end
74
- end
75
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'processor_mixin'
4
+
5
+ module GrafanaReporter
6
+ module Asciidoctor
7
+ module Extensions
8
+ # Implements the hook
9
+ # include::grafana_panel_query_table:<panel_id>[<options>]
10
+ #
11
+ # Returns the results of the SQL query as a asciidoctor table.
12
+ #
13
+ # == Used document parameters
14
+ # +grafana_default_instance+ - name of grafana instance, 'default' if not specified
15
+ #
16
+ # +grafana_default_dashboard+ - uid of grafana default dashboard to use
17
+ #
18
+ # +from+ - 'from' time for the sql query
19
+ #
20
+ # +to+ - 'to' time for the sql query
21
+ #
22
+ # All other variables starting with +var-+ will be used to replace grafana templating strings
23
+ # in the given SQL query.
24
+ #
25
+ # == Supported options
26
+ # +query+ - query letter, which shall be used, e.g. +C+ (*mandatory*)
27
+ #
28
+ # +instance+ - name of grafana instance, 'default' if not specified
29
+ #
30
+ # +dashboard+ - uid of grafana dashboard to use
31
+ #
32
+ # +from+ - 'from' time for the sql query
33
+ #
34
+ # +to+ - 'to' time for the sql query
35
+ #
36
+ # +format+ - see {QueryMixin#format_columns}
37
+ #
38
+ # +replace_values+ - see {QueryMixin#replace_values}
39
+ #
40
+ # +filter_columns+ - see {QueryMixin#filter_columns}
41
+ class PanelQueryTableIncludeProcessor < ::Asciidoctor::Extensions::IncludeProcessor
42
+ include ProcessorMixin
43
+
44
+ # :nodoc:
45
+ def handles?(target)
46
+ target.start_with? 'grafana_panel_query_table:'
47
+ end
48
+
49
+ # :nodoc:
50
+ def process(doc, reader, target, attrs)
51
+ return if @report.cancel
52
+
53
+ @report.next_step
54
+ panel_id = target.split(':')[1]
55
+ instance = attrs['instance'] || doc.attr('grafana_default_instance') || 'default'
56
+ dashboard = attrs['dashboard'] || doc.attr('grafana_default_dashboard')
57
+ @report.logger.debug("Processing PanelQueryTableIncludeProcessor (instance: #{instance}, "\
58
+ "dashboard: #{dashboard}, panel: #{panel_id}, query: #{attrs['query']})")
59
+ query = PanelTableQuery.new(@report.grafana(instance).dashboard(dashboard).panel(panel_id), attrs['query'])
60
+ query.merge_hash_variables(doc.attributes, attrs)
61
+ @report.logger.debug("from: #{query.from}, to: #{query.to}")
62
+
63
+ begin
64
+ reader.unshift_lines query.execute(@report.grafana(instance))
65
+ rescue GrafanaReporterError => e
66
+ @report.logger.error(e.message)
67
+ reader.unshift_line "|#{e.message}"
68
+ rescue StandardError => e
69
+ @report.logger.fatal(e.message)
70
+ reader.unshift_line "|#{e.message}"
71
+ end
72
+
73
+ reader
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end