prometheus-config-builder 0.0.27 → 0.0.28
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 148c59af641af7eaccc1128932c1e355f0498ea6
|
4
|
+
data.tar.gz: 0b1b3f3e74395c1e1bcd0589376e9879a2091ba2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 303514e03da7c927e1eca0df89f35f6e4501326309bf435a2aac8640dc4c7cd72e9cd826407c3f7f39ba0b83762c727c5b8a4afcc69a5f31d227f1c5c87c04ed
|
7
|
+
data.tar.gz: a3313569ed850c158b61fa27812eb6ad85dee6b57a5b4fb82eceef6da6f15694e9e91c5d5c34c821b17e7f689067a372b671e0dc425c918de48272e4c2178f23
|
@@ -77,7 +77,6 @@ something_changed_count = PrometheusExporter::Client.default.register(:counter,
|
|
77
77
|
error_count = PrometheusExporter::Client.default.register(:counter, "prometheusconfigbuilder_errors_count", "Number of exceptions during evaluation.")
|
78
78
|
iteration_count = PrometheusExporter::Client.default.register(:counter, "prometheusconfigbuilder_iteration_count", "Number of times configuration has changed.")
|
79
79
|
iteration_duration = PrometheusExporter::Client.default.register(:gauge, "prometheusconfigbuilder_last_iteration_duration", "Duration (in seconds) of the last full config iteration")
|
80
|
-
config_has_errors = PrometheusExporter::Client.default.register(:gauge, "prometheusconfigbuilder_config_has_errors", "This value is 0 if the config has no errors.")
|
81
80
|
|
82
81
|
error_count.observe(0)
|
83
82
|
|
@@ -93,9 +92,7 @@ loop do
|
|
93
92
|
starting = Time.now
|
94
93
|
begin
|
95
94
|
something_changed = builder.write_out()
|
96
|
-
config_has_errors.observe(0)
|
97
95
|
rescue Exception => e
|
98
|
-
config_has_errors.observe(1)
|
99
96
|
log.warn("Error while building config: #{e}")
|
100
97
|
puts e.backtrace
|
101
98
|
error_count.increment
|
@@ -18,6 +18,7 @@ require 'prometheus_exporter'
|
|
18
18
|
require 'prometheus_exporter/client'
|
19
19
|
|
20
20
|
$config_file_status = PrometheusExporter::Client.default.register(:gauge, "prometheusconfigbuilder_config_file_status", ".")
|
21
|
+
$config_has_errors = PrometheusExporter::Client.default.register(:gauge, "prometheusconfigbuilder_config_has_errors", "This value is 0 if the config has no errors.")
|
21
22
|
|
22
23
|
|
23
24
|
module PrometheusConfigBuilder
|
@@ -177,6 +178,7 @@ module PrometheusConfigBuilder
|
|
177
178
|
|
178
179
|
FileUtils.mkdir_p(scrape_files_dir) if !File.exist?(scrape_files_dir)
|
179
180
|
|
181
|
+
errors = 0
|
180
182
|
@files.each do |file|
|
181
183
|
begin
|
182
184
|
configs = file.get_scrape_configs(scrape_files_dir + "/" + File.basename(file.basename, ".*"))
|
@@ -185,9 +187,13 @@ module PrometheusConfigBuilder
|
|
185
187
|
rescue Exception => e
|
186
188
|
logger.error("Unable to get scrape configs correctly from file #{file.source}. Error: #{e}")
|
187
189
|
$config_file_status.observe(0, file: file.source)
|
190
|
+
errors += 1
|
188
191
|
end
|
189
192
|
end
|
190
193
|
|
194
|
+
$config_has_errors.observe(errors)
|
195
|
+
|
196
|
+
|
191
197
|
if !data["rule_files"] or data["rule_files"].class != Array
|
192
198
|
data["rule_files"] = []
|
193
199
|
end
|