deimos 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 25fb694458065cb85e2f0f5345ba12826836502243ad93bd783dee2e1c6ac927
4
- data.tar.gz: 591f31044e43a5ae78b8eec1bef1e03d85d5350b42128a83001454a7a3592e59
3
+ metadata.gz: 17a40f67812084407c499920df0764fc3be8c16510fec55c79878fd934beb2fb
4
+ data.tar.gz: 41f903f78686b74f7ca02b0790a20536f4cc1d4d8a8b013737169e391735ad5e
5
5
  SHA512:
6
- metadata.gz: 19f30648cabeb2025735e937b2afc1328728559477b43f72fd88d3338e1cb6fe232132d92c3fd24f232df4d858854cff08bda33d92a2a10d26d80cf46c53d1f9
7
- data.tar.gz: b60687588cfd748e1d3e343c6afc8d13f06005fe5f00f223fd9c1411d17251079d872a21d4d74d2fb35f9dc108f969dc9f2892679380eb4216cffb634e1801c9
6
+ metadata.gz: 5a417d5ae7b6d65b48a3c7300c488a6fc6754500bc4cb9c129a6e49e6327841ae5fbfa122a91bc2ea8f81c6c4bfb816313e0df5e02ccac177851d3e82ff8774f
7
+ data.tar.gz: 4853ffa98525c602d4f492d89f891622c521ab2dd4819695cacf55d02b4a2e6dcdddd69904afe3044526d49d8ba7195e087c47d8fe12bc1c483f123cdcb65c20
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- deimos (0.2.6)
4
+ deimos (0.2.8)
5
5
  activesupport
6
6
  concurrent-ruby (~> 1.1.0)
7
7
  huyegger
@@ -8,24 +8,20 @@ module Deimos
8
8
  summary: Prometheus::Client::Summary
9
9
  }
10
10
 
11
- delegate :instrument, to: ActiveSupport::Notifications
11
+ delegate :instrument, :unsubscribe, to: ActiveSupport::Notifications
12
12
 
13
13
  attr_reader :registry
14
14
  def initialize(registry: Prometheus::Client.registry)
15
15
  @registry = registry
16
16
  end
17
17
 
18
- def subscriptions
19
- @subscriptions ||= []
20
- end
21
-
22
18
  def collectors
23
19
  @collectors ||= {}
24
20
  end
25
21
 
26
22
  def subscribe(event_name, type:, label:, **kwargs, &block)
27
23
  Deimos.logger.info "Metrics: Subscribed to #{event_name}..."
28
- subscriptions << ActiveSupport::Notifications.subscribe(event_name) do |*args|
24
+ ActiveSupport::Notifications.subscribe(event_name) do |*args|
29
25
  event = ActiveSupport::Notifications::Event.new(*args)
30
26
  collector = register_collector!(event_name, type, label, kwargs)
31
27
  if block_given?
@@ -2,7 +2,7 @@ module Deimos
2
2
  module Status
3
3
  class Runner
4
4
  def initialize(checks)
5
- @checks = checks.dup
5
+ @checks = checks
6
6
  end
7
7
 
8
8
  def status
@@ -1,3 +1,3 @@
1
1
  module Deimos
2
- VERSION = "0.2.7"
2
+ VERSION = "0.2.8"
3
3
  end
data/lib/deimos.rb CHANGED
@@ -32,7 +32,7 @@ module Deimos
32
32
  end
33
33
 
34
34
  def application
35
- Rack::Builder.new do
35
+ @application ||= Rack::Builder.new do
36
36
  Deimos.middleware.each { |m| use m }
37
37
  run Rack::URLMap.new(Deimos.applications)
38
38
  end
@@ -57,8 +57,8 @@ module Deimos
57
57
  end
58
58
 
59
59
  def applications
60
- require 'deimos/endpoints/status'
61
- require 'deimos/endpoints/metrics'
60
+ load! unless loaded?
61
+
62
62
  @applications ||= {
63
63
  "/status" => Deimos::Endpoints::Status.new(status: status),
64
64
  "/metrics" => Deimos::Endpoints::Metrics.new(metrics: metrics)
@@ -77,4 +77,14 @@ module Deimos
77
77
  @logger ||= Huyegger::Logger.new(::Logger.new(STDOUT).tap {|x| x.level = config.log_level})
78
78
  end
79
79
 
80
+ def load!
81
+ require 'deimos/endpoints/status'
82
+ require 'deimos/endpoints/metrics'
83
+ @loaded = true
84
+ end
85
+
86
+ def loaded?
87
+ @loaded
88
+ end
89
+
80
90
  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.7
4
+ version: 0.2.8
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-14 00:00:00.000000000 Z
11
+ date: 2019-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sinatra