deimos 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -4
- data/lib/deimos/endpoints/status.rb +6 -1
- data/lib/deimos/metrics/manager.rb +7 -6
- data/lib/deimos/version.rb +1 -1
- data/lib/deimos.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c5207cb6a1186d4fed8df2a7fba23b39819fbe0474cd7dc5734ed7ab337b161
|
4
|
+
data.tar.gz: d3884e15b4c88383ffc4a8b466eb790911f97285b74acda94e156c93025accbd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a7824029d14dfa72b33359743d5a9f7def3cbbaa1a22c08aba38680a0761a68fa4a3905db1e8951982a8dc2081cefa52c7f15e36389c6719ae8885b05c81662
|
7
|
+
data.tar.gz: f06bb8e562a34f4073f5c25c864f0cadabbb0cee51b8e3f9f5fb4df30886200455f23ef8cc69f9f5155ad1c6067d395057579dc4f720ba154e24d0d1ea54512f
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
deimos (0.
|
4
|
+
deimos (0.2.4)
|
5
5
|
activesupport
|
6
|
-
concurrent-ruby
|
6
|
+
concurrent-ruby (~> 1.1.0)
|
7
7
|
huyegger
|
8
8
|
prometheus-client
|
9
9
|
sinatra
|
@@ -12,14 +12,14 @@ PATH
|
|
12
12
|
GEM
|
13
13
|
remote: https://rubygems.org/
|
14
14
|
specs:
|
15
|
-
activesupport (5.2.2)
|
15
|
+
activesupport (5.2.2.1)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
17
|
i18n (>= 0.7, < 2)
|
18
18
|
minitest (~> 5.1)
|
19
19
|
tzinfo (~> 1.1)
|
20
20
|
backports (3.12.0)
|
21
21
|
coderay (1.1.2)
|
22
|
-
concurrent-ruby (1.1.
|
22
|
+
concurrent-ruby (1.1.5)
|
23
23
|
diff-lcs (1.3)
|
24
24
|
huyegger (0.4.4)
|
25
25
|
i18n (1.6.0)
|
@@ -37,6 +37,8 @@ GEM
|
|
37
37
|
rack (2.0.6)
|
38
38
|
rack-protection (2.0.5)
|
39
39
|
rack
|
40
|
+
rack-test (1.1.0)
|
41
|
+
rack (>= 1.0, < 3)
|
40
42
|
rake (10.5.0)
|
41
43
|
rspec (3.8.0)
|
42
44
|
rspec-core (~> 3.8.0)
|
@@ -75,6 +77,7 @@ DEPENDENCIES
|
|
75
77
|
bundler (~> 1.16)
|
76
78
|
deimos!
|
77
79
|
pry
|
80
|
+
rack-test
|
78
81
|
rake (~> 10.0)
|
79
82
|
rspec (~> 3.0)
|
80
83
|
|
@@ -1,11 +1,16 @@
|
|
1
1
|
module Deimos
|
2
2
|
module Endpoints
|
3
3
|
class Status < Sinatra::Application
|
4
|
+
def initialize(status:)
|
5
|
+
@status = status
|
6
|
+
super
|
7
|
+
end
|
8
|
+
|
4
9
|
disable :logging
|
5
10
|
set :logger, Deimos.logger
|
6
11
|
|
7
12
|
get "/" do
|
8
|
-
status_runner =
|
13
|
+
status_runner = @status.run!
|
9
14
|
|
10
15
|
content_type :json
|
11
16
|
status status_runner.status
|
@@ -9,7 +9,12 @@ module Deimos
|
|
9
9
|
}
|
10
10
|
|
11
11
|
delegate :instrument, to: ActiveSupport::Notifications
|
12
|
-
|
12
|
+
|
13
|
+
attr_reader :registry
|
14
|
+
def initialize(registry: Prometheus::Client.registry)
|
15
|
+
@registry = registry
|
16
|
+
end
|
17
|
+
|
13
18
|
def subscriptions
|
14
19
|
@subscriptions ||= []
|
15
20
|
end
|
@@ -18,10 +23,6 @@ module Deimos
|
|
18
23
|
@collectors ||= {}
|
19
24
|
end
|
20
25
|
|
21
|
-
def registry
|
22
|
-
@registry ||= Prometheus::Client.registry
|
23
|
-
end
|
24
|
-
|
25
26
|
def subscribe(event_name, type:, label:, **kwargs, &block)
|
26
27
|
Deimos.logger.info "Metrics: Subscribed to #{event_name}..."
|
27
28
|
subscriptions << ActiveSupport::Notifications.subscribe(event_name) do |*args|
|
@@ -38,7 +39,7 @@ module Deimos
|
|
38
39
|
private
|
39
40
|
|
40
41
|
def register_collector!(event_name, type, about, **kwargs)
|
41
|
-
return collectors[event_name] if collectors[event_name]
|
42
|
+
return collectors[event_name] if collectors[event_name]
|
42
43
|
name = event_name.gsub(".", "_").to_sym
|
43
44
|
collectors[event_name] = TYPES[type].new(name, about, kwargs).tap { |x| registry.register(x) }
|
44
45
|
end
|
data/lib/deimos/version.rb
CHANGED
data/lib/deimos.rb
CHANGED
@@ -60,8 +60,8 @@ module Deimos
|
|
60
60
|
|
61
61
|
def applications
|
62
62
|
@applications ||= {
|
63
|
-
"/status" => Deimos::Endpoints::Status,
|
64
|
-
"/metrics" => Deimos::Endpoints::Metrics
|
63
|
+
"/status" => Deimos::Endpoints::Status.new(status: status),
|
64
|
+
"/metrics" => Deimos::Endpoints::Metrics.new
|
65
65
|
}.merge(config.applications)
|
66
66
|
end
|
67
67
|
|
@@ -76,5 +76,5 @@ module Deimos
|
|
76
76
|
def logger
|
77
77
|
@logger ||= Huyegger::Logger.new(::Logger.new(STDOUT).tap {|x| x.level = config.log_level})
|
78
78
|
end
|
79
|
-
|
79
|
+
|
80
80
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deimos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Carlile
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|