prometheus-config-builder 0.0.15 → 0.0.21
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: 4d84c84caac7f0380510bf269507555f04be391e
|
4
|
+
data.tar.gz: b9220355ba8986d22711ec49365f885cb374c8ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36fbaf95d4db081453a29f6aac99a26ece35e66501297664843bc4d9a88a697ab736da051d5ba4763d95d43515dc5bac74bf67b28906c39f9bb80b1cbefc795c
|
7
|
+
data.tar.gz: f599a9aebffb8d5ac632824590824abc812fb522640a6cb196e31a166bc8a6c49e89ddbe5427d1e3f27dcab5213588336efaee50d03b7a80cba44e9d6ef9fd0d
|
@@ -39,7 +39,7 @@ op = OptionParser.new do |o|
|
|
39
39
|
config[:verbose] = true
|
40
40
|
end
|
41
41
|
o.on('--every=[seconds]', 'Rerun every n seconds') do |seconds|
|
42
|
-
config[:every] = seconds
|
42
|
+
config[:every] = seconds.to_i
|
43
43
|
end
|
44
44
|
o.on('--pgrep=[string]', 'pgrep -f [string] for finding Prometheus process for SIGHUP') do |str|
|
45
45
|
config[:pgrep] = str
|
@@ -52,7 +52,7 @@ if config[:verbose]
|
|
52
52
|
end
|
53
53
|
|
54
54
|
abort "You need to set --prometheus-src" if !config[:prometheus_src]
|
55
|
-
abort "You need to set --
|
55
|
+
abort "You need to set --dst-dir" if !config[:dst_dir]
|
56
56
|
|
57
57
|
log = Logger.new(STDOUT)
|
58
58
|
log.level = config[:verbose] ? Logger::DEBUG : Logger::INFO
|
@@ -75,6 +75,7 @@ something_changed_count = PrometheusExporter::Client.default.register(:counter,
|
|
75
75
|
error_count = PrometheusExporter::Client.default.register(:counter, "prometheusconfigbuilder_errors_count", "Number of exceptions during evaluation.")
|
76
76
|
iteration_count = PrometheusExporter::Client.default.register(:counter, "prometheusconfigbuilder_iteration_count", "Number of times configuration has changed.")
|
77
77
|
iteration_duration = PrometheusExporter::Client.default.register(:gauge, "prometheusconfigbuilder_last_iteration_duration", "Duration (in seconds) of the last full config iteration")
|
78
|
+
config_has_errors = PrometheusExporter::Client.default.register(:gauge, "prometheusconfigbuilder_config_has_errors", "This value is 0 if the config has no errors.")
|
78
79
|
|
79
80
|
error_count.observe(0)
|
80
81
|
|
@@ -90,7 +91,9 @@ loop do
|
|
90
91
|
starting = Time.now
|
91
92
|
begin
|
92
93
|
something_changed = builder.write_out()
|
94
|
+
config_has_errors.observe(0)
|
93
95
|
rescue Exception => e
|
96
|
+
config_has_errors.observe(1)
|
94
97
|
log.warn("Error while building config: #{e}")
|
95
98
|
puts e.backtrace
|
96
99
|
error_count.increment
|
@@ -104,10 +107,16 @@ loop do
|
|
104
107
|
# Send a SIGHUP signal to Prometheus so that it knows to reload config files
|
105
108
|
begin
|
106
109
|
if something_changed && config[:pgrep] != nil
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
110
|
+
matches = `pgrep -a -f "#{config[:pgrep]}"`.split("\n")
|
111
|
+
match = matches.select {|e| !e.include?("prometheus-config-builder")}
|
112
|
+
if !match
|
113
|
+
log.warn("Unable to find Prometheus instance to send SIGHUP for. Matches object: #{matches}")
|
114
|
+
else
|
115
|
+
pid = match.first.split(" ").first.to_i
|
116
|
+
if pid
|
117
|
+
log.info("Sending SIGHUP signal to Prometheus at pid #{pid}.")
|
118
|
+
Process.kill "HUP", pid
|
119
|
+
end
|
111
120
|
end
|
112
121
|
end
|
113
122
|
rescue Exception => e
|
@@ -217,7 +217,7 @@ module PrometheusConfigBuilder
|
|
217
217
|
files = []
|
218
218
|
@paths.each do |path|
|
219
219
|
found_files = @discoverer.discover(path)
|
220
|
-
logger.info("Found #{
|
220
|
+
logger.info("Found #{found_files.length} files from path #{path}")
|
221
221
|
files.push(*found_files)
|
222
222
|
end
|
223
223
|
|
@@ -70,7 +70,7 @@ module PrometheusConfigBuilder
|
|
70
70
|
tasks.push(*last_result.task_arns)
|
71
71
|
end
|
72
72
|
rescue Aws::ECS::Errors::ServiceError => e
|
73
|
-
print "Error listing ecs tasks: #{e}"
|
73
|
+
print "Error listing ecs tasks for service #{service_name} in cluster #{cluster}: #{e}"
|
74
74
|
sleep(1)
|
75
75
|
next
|
76
76
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus-config-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juho Mäkinen juho.makinen@gmail.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.5.2
|
140
|
+
rubygems_version: 2.5.2.3
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: Template based config generation
|