ruby-grafana-reporter 0.1.6
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.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/README.md +248 -0
- data/lib/VERSION.rb +3 -0
- data/lib/grafana/abstract_panel_query.rb +20 -0
- data/lib/grafana/abstract_query.rb +127 -0
- data/lib/grafana/abstract_sql_query.rb +42 -0
- data/lib/grafana/dashboard.rb +66 -0
- data/lib/grafana/errors.rb +61 -0
- data/lib/grafana/grafana.rb +131 -0
- data/lib/grafana/panel.rb +39 -0
- data/lib/grafana/panel_image_query.rb +49 -0
- data/lib/grafana/variable.rb +259 -0
- data/lib/grafana_reporter/abstract_report.rb +109 -0
- data/lib/grafana_reporter/application/application.rb +229 -0
- data/lib/grafana_reporter/application/errors.rb +30 -0
- data/lib/grafana_reporter/asciidoctor/alerts_table_query.rb +99 -0
- data/lib/grafana_reporter/asciidoctor/annotations_table_query.rb +96 -0
- data/lib/grafana_reporter/asciidoctor/errors.rb +37 -0
- data/lib/grafana_reporter/asciidoctor/extensions/alerts_table_include_processor.rb +86 -0
- data/lib/grafana_reporter/asciidoctor/extensions/annotations_table_include_processor.rb +86 -0
- data/lib/grafana_reporter/asciidoctor/extensions/panel_image_block_macro.rb +67 -0
- data/lib/grafana_reporter/asciidoctor/extensions/panel_image_inline_macro.rb +65 -0
- data/lib/grafana_reporter/asciidoctor/extensions/panel_property_inline_macro.rb +58 -0
- data/lib/grafana_reporter/asciidoctor/extensions/panel_query_table_include_processor.rb +75 -0
- data/lib/grafana_reporter/asciidoctor/extensions/panel_query_value_inline_macro.rb +70 -0
- data/lib/grafana_reporter/asciidoctor/extensions/processor_mixin.rb +18 -0
- data/lib/grafana_reporter/asciidoctor/extensions/show_environment_include_processor.rb +41 -0
- data/lib/grafana_reporter/asciidoctor/extensions/show_help_include_processor.rb +202 -0
- data/lib/grafana_reporter/asciidoctor/extensions/sql_table_include_processor.rb +67 -0
- data/lib/grafana_reporter/asciidoctor/extensions/sql_value_inline_macro.rb +65 -0
- data/lib/grafana_reporter/asciidoctor/extensions/value_as_variable_include_processor.rb +57 -0
- data/lib/grafana_reporter/asciidoctor/panel_first_value_query.rb +32 -0
- data/lib/grafana_reporter/asciidoctor/panel_image_query.rb +23 -0
- data/lib/grafana_reporter/asciidoctor/panel_property_query.rb +43 -0
- data/lib/grafana_reporter/asciidoctor/panel_table_query.rb +36 -0
- data/lib/grafana_reporter/asciidoctor/query_mixin.rb +309 -0
- data/lib/grafana_reporter/asciidoctor/report.rb +159 -0
- data/lib/grafana_reporter/asciidoctor/sql_first_value_query.rb +34 -0
- data/lib/grafana_reporter/asciidoctor/sql_table_query.rb +32 -0
- data/lib/grafana_reporter/configuration.rb +326 -0
- data/lib/grafana_reporter/errors.rb +38 -0
- data/lib/grafana_reporter/logger/two_way_logger.rb +52 -0
- data/lib/ruby-grafana-reporter.rb +27 -0
- metadata +88 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
module GrafanaReporter
|
2
|
+
# General error of the reporter. All other errors will inherit from this class.
|
3
|
+
class GrafanaReporterError < StandardError
|
4
|
+
def initialize(message)
|
5
|
+
super('GrafanaReporterError: ' + message.to_s)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
# Thrown, if the requested grafana instance does not have the mandatory 'host'
|
10
|
+
# setting configured.
|
11
|
+
class GrafanaInstanceWithoutHostError < GrafanaReporterError
|
12
|
+
def initialize(instance)
|
13
|
+
super("Grafana instance '#{instance}' has been configured without mandatory 'host' setting.")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# General configuration error. All configuration errors inherit from this class.
|
18
|
+
class ConfigurationError < GrafanaReporterError
|
19
|
+
def initialize(message)
|
20
|
+
super("Configuration error: #{message}")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Thrown, if a configured path does not exist.
|
25
|
+
class FolderDoesNotExistError < ConfigurationError
|
26
|
+
def initialize(folder, config_item)
|
27
|
+
super("#{config_item} '#{folder}' does not exist.")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Thrown if the configuration does not match the expected schema.
|
32
|
+
# Details about how to fix that are provided in the message.
|
33
|
+
class ConfigurationDoesNotMatchSchemaError < ConfigurationError
|
34
|
+
def initialize(item, verb, expected, currently)
|
35
|
+
super("Configuration file does not match schema definition. Expected '#{item}' to #{verb} '#{expected}', but was '#{currently}'.")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module GrafanaReporter
|
2
|
+
|
3
|
+
# This module contains special extensions for use in the reporter.
|
4
|
+
module Logger
|
5
|
+
|
6
|
+
# This logger enables a special use case, so that one and the same log
|
7
|
+
# will automatically be send to two different logger destinations.
|
8
|
+
#
|
9
|
+
# One destination is the set {#additional_logger=} which respects the
|
10
|
+
# configured severity. The other destination is an internal logger, which
|
11
|
+
# will always log all messages in mode Logger::Severity::Debug. All messages
|
12
|
+
# of the internal logger can easily be retrieved, by using the
|
13
|
+
# {#internal_messages} method.
|
14
|
+
#
|
15
|
+
# Except the {#level=} setting, all calls to the logger will immediately
|
16
|
+
# be delegated to the internal logger and the configured {#additional_logger=}.
|
17
|
+
# By having this behavior, the class can be used wherever the standard Logger
|
18
|
+
# can also be used.
|
19
|
+
class TwoWayDelegateLogger
|
20
|
+
def initialize
|
21
|
+
@internal_messages = StringIO.new
|
22
|
+
@internal_logger = ::Logger.new(@internal_messages)
|
23
|
+
@internal_logger.level = ::Logger::Severity::DEBUG
|
24
|
+
@additional_logger = ::Logger.new(nil)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Sets the severity level of the additional logger to the given severity.
|
28
|
+
# @param severity one of {Logger::Severity}
|
29
|
+
def level=(severity)
|
30
|
+
@additional_logger.level = severity
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [String] all messages of the internal logger.
|
34
|
+
def internal_messages
|
35
|
+
@internal_messages.string
|
36
|
+
end
|
37
|
+
|
38
|
+
# Used to set the additional logger in this class to an already existing
|
39
|
+
# logger.
|
40
|
+
# @param logger [Logger] sets the additional logger to the given value.
|
41
|
+
def additional_logger=(logger)
|
42
|
+
@additional_logger = logger || ::Logger.new(nil)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Delegates all not configured calls to the internal and the additional logger.
|
46
|
+
def method_missing(method, *args)
|
47
|
+
@internal_logger.send(method, *args)
|
48
|
+
@additional_logger.send(method, *args)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'net/http'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'yaml'
|
4
|
+
require 'socket'
|
5
|
+
require 'uri'
|
6
|
+
require 'json'
|
7
|
+
require 'tempfile'
|
8
|
+
require 'cgi'
|
9
|
+
require 'optparse'
|
10
|
+
require 'date'
|
11
|
+
require 'time'
|
12
|
+
require 'logger'
|
13
|
+
require 'asciidoctor'
|
14
|
+
require 'asciidoctor/extensions'
|
15
|
+
require 'asciidoctor-pdf'
|
16
|
+
require 'zip'
|
17
|
+
require_relative 'VERSION.rb'
|
18
|
+
|
19
|
+
folders = [
|
20
|
+
%w[grafana],
|
21
|
+
%w[grafana_reporter logger],
|
22
|
+
%w[grafana_reporter],
|
23
|
+
%w[grafana_reporter asciidoctor extensions],
|
24
|
+
%w[grafana_reporter asciidoctor],
|
25
|
+
%w[grafana_reporter application]
|
26
|
+
]
|
27
|
+
folders.each { |folder| Dir[File.join(__dir__, *folder, '*.rb')].sort.each { |file| require_relative file } }
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby-grafana-reporter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Christian Kohlmeyer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-10-19 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |-
|
14
|
+
The reporter provides a full extension setup for the famous Asciidoctor and can perfectly integrate in a docker environment. It can be used as to convert single documents or run as a service.
|
15
|
+
|
16
|
+
As a result of the reporter, you receive PDF documents or any other format that is supported by Asciidoctor.
|
17
|
+
email: kohly@gmx.de
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- "./lib/VERSION.rb"
|
23
|
+
- "./lib/grafana/abstract_panel_query.rb"
|
24
|
+
- "./lib/grafana/abstract_query.rb"
|
25
|
+
- "./lib/grafana/abstract_sql_query.rb"
|
26
|
+
- "./lib/grafana/dashboard.rb"
|
27
|
+
- "./lib/grafana/errors.rb"
|
28
|
+
- "./lib/grafana/grafana.rb"
|
29
|
+
- "./lib/grafana/panel.rb"
|
30
|
+
- "./lib/grafana/panel_image_query.rb"
|
31
|
+
- "./lib/grafana/variable.rb"
|
32
|
+
- "./lib/grafana_reporter/abstract_report.rb"
|
33
|
+
- "./lib/grafana_reporter/application/application.rb"
|
34
|
+
- "./lib/grafana_reporter/application/errors.rb"
|
35
|
+
- "./lib/grafana_reporter/asciidoctor/alerts_table_query.rb"
|
36
|
+
- "./lib/grafana_reporter/asciidoctor/annotations_table_query.rb"
|
37
|
+
- "./lib/grafana_reporter/asciidoctor/errors.rb"
|
38
|
+
- "./lib/grafana_reporter/asciidoctor/extensions/alerts_table_include_processor.rb"
|
39
|
+
- "./lib/grafana_reporter/asciidoctor/extensions/annotations_table_include_processor.rb"
|
40
|
+
- "./lib/grafana_reporter/asciidoctor/extensions/panel_image_block_macro.rb"
|
41
|
+
- "./lib/grafana_reporter/asciidoctor/extensions/panel_image_inline_macro.rb"
|
42
|
+
- "./lib/grafana_reporter/asciidoctor/extensions/panel_property_inline_macro.rb"
|
43
|
+
- "./lib/grafana_reporter/asciidoctor/extensions/panel_query_table_include_processor.rb"
|
44
|
+
- "./lib/grafana_reporter/asciidoctor/extensions/panel_query_value_inline_macro.rb"
|
45
|
+
- "./lib/grafana_reporter/asciidoctor/extensions/processor_mixin.rb"
|
46
|
+
- "./lib/grafana_reporter/asciidoctor/extensions/show_environment_include_processor.rb"
|
47
|
+
- "./lib/grafana_reporter/asciidoctor/extensions/show_help_include_processor.rb"
|
48
|
+
- "./lib/grafana_reporter/asciidoctor/extensions/sql_table_include_processor.rb"
|
49
|
+
- "./lib/grafana_reporter/asciidoctor/extensions/sql_value_inline_macro.rb"
|
50
|
+
- "./lib/grafana_reporter/asciidoctor/extensions/value_as_variable_include_processor.rb"
|
51
|
+
- "./lib/grafana_reporter/asciidoctor/panel_first_value_query.rb"
|
52
|
+
- "./lib/grafana_reporter/asciidoctor/panel_image_query.rb"
|
53
|
+
- "./lib/grafana_reporter/asciidoctor/panel_property_query.rb"
|
54
|
+
- "./lib/grafana_reporter/asciidoctor/panel_table_query.rb"
|
55
|
+
- "./lib/grafana_reporter/asciidoctor/query_mixin.rb"
|
56
|
+
- "./lib/grafana_reporter/asciidoctor/report.rb"
|
57
|
+
- "./lib/grafana_reporter/asciidoctor/sql_first_value_query.rb"
|
58
|
+
- "./lib/grafana_reporter/asciidoctor/sql_table_query.rb"
|
59
|
+
- "./lib/grafana_reporter/configuration.rb"
|
60
|
+
- "./lib/grafana_reporter/errors.rb"
|
61
|
+
- "./lib/grafana_reporter/logger/two_way_logger.rb"
|
62
|
+
- "./lib/ruby-grafana-reporter.rb"
|
63
|
+
- LICENSE
|
64
|
+
- README.md
|
65
|
+
homepage: https://github.com/divinity666/ruby-grafana-reporter
|
66
|
+
licenses:
|
67
|
+
- MIT
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubygems_version: 3.1.4
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: "(Asciidoctor) Reporter Service for Grafana"
|
88
|
+
test_files: []
|