prometheus-splash 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +25 -0
- data/CHANGELOG +26 -0
- data/README.md +37 -1
- data/assets/images/splash_design.png +0 -0
- data/bin/splash +9 -1
- data/config/splash.yml +13 -3
- data/lib/splash/backends/file.rb +16 -0
- data/lib/splash/cli/commands.rb +117 -41
- data/lib/splash/cli/config.rb +7 -5
- data/lib/splash/cli/daemon.rb +8 -4
- data/lib/splash/cli/logs.rb +32 -18
- data/lib/splash/commands.rb +17 -16
- data/lib/splash/config.rb +4 -0
- data/lib/splash/config/sanitycheck.rb +23 -19
- data/lib/splash/config/setup.rb +15 -11
- data/lib/splash/constants.rb +9 -5
- data/lib/splash/controller.rb +20 -10
- data/lib/splash/dependencies.rb +3 -0
- data/lib/splash/exiter.rb +4 -2
- data/lib/splash/helpers.rb +30 -4
- data/lib/splash/loggers.rb +89 -0
- data/lib/splash/loggers/cli.rb +83 -0
- data/lib/splash/loggers/daemon.rb +32 -0
- data/lib/splash/loggers/dual.rb +22 -0
- data/lib/splash/logs.rb +4 -3
- data/lib/splash/orchestrator.rb +17 -8
- data/lib/splash/orchestrator/grammar.rb +13 -6
- data/lib/splash/transports.rb +2 -2
- data/lib/splash/transports/rabbitmq.rb +16 -2
- data/prometheus-splash.gemspec +2 -1
- metadata +23 -2
@@ -4,7 +4,15 @@ module Splash
|
|
4
4
|
module Grammar
|
5
5
|
|
6
6
|
include Splash::Config
|
7
|
-
|
7
|
+
include Splash::Loggers
|
8
|
+
|
9
|
+
|
10
|
+
VERBS=[:ping,:list_commands,:execute_command,:ack_command, :shutdown]
|
11
|
+
|
12
|
+
|
13
|
+
def shutdown
|
14
|
+
self.terminate
|
15
|
+
end
|
8
16
|
|
9
17
|
def ping(payload)
|
10
18
|
return "Pong : #{payload[:hostname]} !"
|
@@ -22,21 +30,20 @@ module Splash
|
|
22
30
|
|
23
31
|
def execute_command(payload)
|
24
32
|
unless get_config.commands.include? payload[:name].to_sym
|
25
|
-
|
33
|
+
@log.item "Command not found"
|
26
34
|
return { :case => :not_found }
|
27
35
|
end
|
28
36
|
if payload.include? :schedule then
|
29
37
|
sched,value = payload[:schedule].flatten
|
30
|
-
|
38
|
+
@log.schedule "remote call command #{payload[:name]}, scheduling : #{sched.to_s} #{value}"
|
31
39
|
@server.send sched,value do
|
40
|
+
@log.trigger "Executing Scheduled command #{payload[:name]} for Scheduling : #{sched.to_s} #{value}"
|
32
41
|
self.execute command: payload[:name]
|
33
42
|
end
|
34
43
|
return { :case => :quiet_exit }
|
35
44
|
else
|
36
|
-
|
37
|
-
puts payload[:name]
|
45
|
+
@log.info "Execute direct command"
|
38
46
|
res = self.execute command: payload[:name]
|
39
|
-
puts res.inspect
|
40
47
|
return res
|
41
48
|
end
|
42
49
|
end
|
data/lib/splash/transports.rb
CHANGED
@@ -16,7 +16,7 @@ module Splash
|
|
16
16
|
begin
|
17
17
|
return Kernel.const_get(aclass)::new(options)
|
18
18
|
rescue
|
19
|
-
return { :case => :configuration_error, :more => "Transport specified for queue #{options[:queue]}
|
19
|
+
return { :case => :configuration_error, :more => "Transport specified for queue #{options[:queue]} configuration error : #{transport}"}
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
@@ -32,7 +32,7 @@ module Splash
|
|
32
32
|
begin
|
33
33
|
return Kernel.const_get(aclass)::new
|
34
34
|
rescue
|
35
|
-
return { :case => :configuration_error, :more => "Transport
|
35
|
+
return { :case => :configuration_error, :more => "Transport configuration error : #{transport}"}
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -11,9 +11,15 @@ module Splash
|
|
11
11
|
|
12
12
|
def initialize(options = {})
|
13
13
|
@config = get_config.transports
|
14
|
+
@url = "amqp://"
|
14
15
|
host = @config[:rabbitmq][:host]
|
15
16
|
port = @config[:rabbitmq][:port]
|
16
|
-
|
17
|
+
vhost = @config[:rabbitmq][:vhost]
|
18
|
+
if @config[:rabbitmq][:user] and @config[:rabbitmq][:passwd] then
|
19
|
+
creds = "#{@config[:rabbitmq][:user]}:#{@config[:rabbitmq][:passwd]}@"
|
20
|
+
@url << creds
|
21
|
+
end
|
22
|
+
@url << "#{host}:#{port}#{vhost}"
|
17
23
|
begin
|
18
24
|
@connection = Bunny.new url: @url
|
19
25
|
@connection.start
|
@@ -31,12 +37,19 @@ module Splash
|
|
31
37
|
class Client
|
32
38
|
include Splash::Config
|
33
39
|
include Splash::Transports
|
40
|
+
include Splash::Loggers
|
34
41
|
|
35
42
|
def initialize
|
36
43
|
@config = get_config.transports
|
44
|
+
@url = "amqp://"
|
37
45
|
host = @config[:rabbitmq][:host]
|
38
46
|
port = @config[:rabbitmq][:port]
|
39
|
-
|
47
|
+
vhost = @config[:rabbitmq][:vhost]
|
48
|
+
if @config[:rabbitmq][:user] and @config[:rabbitmq][:passwd] then
|
49
|
+
creds = "#{@config[:rabbitmq][:user]}:#{@config[:rabbitmq][:passwd]}@"
|
50
|
+
@url << creds
|
51
|
+
end
|
52
|
+
@url << "#{host}:#{port}#{vhost}"
|
40
53
|
begin
|
41
54
|
@connection = Bunny.new url: @url
|
42
55
|
@connection.start
|
@@ -69,6 +82,7 @@ module Splash
|
|
69
82
|
|
70
83
|
lock.synchronize { condition.signal }
|
71
84
|
end
|
85
|
+
get_logger.send "Verb : #{order[:verb].to_s} to queue : #{order[:queue]}."
|
72
86
|
get_default_client.publish queue: order[:queue], message: order.to_yaml
|
73
87
|
lock.synchronize { condition.wait(lock) }
|
74
88
|
return res
|
data/prometheus-splash.gemspec
CHANGED
@@ -25,7 +25,8 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_runtime_dependency 'redis','~> 4.1.3'
|
26
26
|
spec.add_runtime_dependency 'bunny','~> 2.15.0'
|
27
27
|
spec.add_runtime_dependency 'tty-markdown','~> 0.6.0'
|
28
|
-
spec.add_runtime_dependency 'tty-pager','~> 0.12.1'
|
28
|
+
spec.add_runtime_dependency 'tty-pager','~> 0.12.1'
|
29
|
+
spec.add_runtime_dependency 'colorize','~> 0.8.1'
|
29
30
|
spec.add_development_dependency 'rake', '~> 13.0.1'
|
30
31
|
spec.add_development_dependency 'rspec', '~> 3.9.0'
|
31
32
|
spec.add_development_dependency 'yard', '~> 0.9.24'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus-splash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Romain GEORGES
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: 0.12.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: colorize
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.8.1
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.8.1
|
111
125
|
- !ruby/object:Gem::Dependency
|
112
126
|
name: rake
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -215,6 +229,8 @@ executables:
|
|
215
229
|
extensions: []
|
216
230
|
extra_rdoc_files: []
|
217
231
|
files:
|
232
|
+
- ".github/workflows/ruby.yml"
|
233
|
+
- CHANGELOG
|
218
234
|
- Gemfile
|
219
235
|
- LICENSE.txt
|
220
236
|
- README.md
|
@@ -223,6 +239,7 @@ files:
|
|
223
239
|
- assets/images/logo_splash.png
|
224
240
|
- assets/images/logo_splash_reduce.png
|
225
241
|
- assets/images/prom_pg_logs.png
|
242
|
+
- assets/images/splash_design.png
|
226
243
|
- bin/splash
|
227
244
|
- config/splash.yml
|
228
245
|
- lib/splash/backends.rb
|
@@ -243,6 +260,10 @@ files:
|
|
243
260
|
- lib/splash/dependencies.rb
|
244
261
|
- lib/splash/exiter.rb
|
245
262
|
- lib/splash/helpers.rb
|
263
|
+
- lib/splash/loggers.rb
|
264
|
+
- lib/splash/loggers/cli.rb
|
265
|
+
- lib/splash/loggers/daemon.rb
|
266
|
+
- lib/splash/loggers/dual.rb
|
246
267
|
- lib/splash/logs.rb
|
247
268
|
- lib/splash/orchestrator.rb
|
248
269
|
- lib/splash/orchestrator/grammar.rb
|