liquid-ext 2.0.3 → 3.0.0

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.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +0 -1
  3. data/Gemfile.lock +17 -25
  4. data/bin/liquid +2 -2
  5. data/lib/liquid/benchmark.rb +1 -1
  6. data/lib/liquid/boot.rb +53 -41
  7. data/lib/liquid/cli.rb +1 -6
  8. data/lib/liquid/configuration.rb +105 -122
  9. data/lib/liquid/{generator.rb → console.rb} +8 -1
  10. data/lib/liquid/ext/string.rb +8 -0
  11. data/lib/liquid/ext/thread.rb +6 -0
  12. data/lib/liquid/guava-16.0.1.jar +0 -0
  13. data/lib/liquid/health_checks.rb +4 -10
  14. data/lib/liquid/jeromq-0.3.3.jar +0 -0
  15. data/lib/liquid/kafka_2.10-0.8.0.jar +0 -0
  16. data/lib/liquid/log4j-1.2.17.jar +0 -0
  17. data/lib/liquid/logger.rb +122 -0
  18. data/lib/liquid/metrics/logger_reporter.rb +3 -6
  19. data/lib/liquid/metrics/reporter.rb +25 -13
  20. data/lib/liquid/metrics/tracker_reporter.rb +33 -0
  21. data/lib/liquid/metrics-annotation-2.2.0.jar +0 -0
  22. data/lib/liquid/metrics-core-2.2.0.jar +0 -0
  23. data/lib/liquid/metrics-core-3.0.1.jar +0 -0
  24. data/lib/liquid/metrics-healthchecks-3.0.1.jar +0 -0
  25. data/lib/liquid/metrics.rb +20 -21
  26. data/lib/liquid/router.rb +0 -1
  27. data/lib/liquid/scala-library-2.10.3.jar +0 -0
  28. data/lib/liquid/slf4j-api-1.7.6.jar +0 -0
  29. data/lib/liquid/slf4j-log4j12-1.7.6.jar +0 -0
  30. data/lib/liquid/snappy-java-1.1.1-M1.jar +0 -0
  31. data/lib/liquid/templates/config.yml.tt +0 -1
  32. data/lib/liquid/timing.rb +2 -10
  33. data/lib/liquid/tracker/base.rb +26 -0
  34. data/lib/liquid/tracker/blackhole_tracker.rb +15 -0
  35. data/lib/liquid/tracker/file_tracker.rb +21 -0
  36. data/lib/liquid/tracker/json_serializer.rb +13 -0
  37. data/lib/liquid/tracker/kafka_tracker.rb +41 -0
  38. data/lib/liquid/tracker/logger_tracker.rb +17 -0
  39. data/lib/liquid/tracker.rb +14 -0
  40. data/lib/liquid/transaction_id.rb +2 -2
  41. data/lib/liquid/trove-3.0.3.jar +0 -0
  42. data/lib/liquid/zmq.rb +89 -0
  43. data/liquid-ext.gemspec +1 -2
  44. data/spec/lib/liquid/router_spec.rb +6 -8
  45. data/spec/lib/liquid/weighted_selector_spec.rb +3 -1
  46. metadata +29 -34
  47. data/Jarfile +0 -2
  48. data/Jarfile.lock +0 -14
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5b4739125c0f045cc43cf1d3dc7658d0d06f0b64
4
+ data.tar.gz: e3bd9b7031b166c16c799c7064149bb2c2cc4499
5
+ SHA512:
6
+ metadata.gz: 02a4e55a0fc87c47b2e2f994c2d6ae8fe056847b5bc60968e3d0751d1cc852770bd93fd36f9d13eb6f6f870d33c10d21bca067441ea3e4ee1a568c67f434a4db
7
+ data.tar.gz: f732a993fc2509cbe4e89c73021d49170ec8776bd9a348a8d4fce366918c471a6577d52b3ce49e91bcabdcc0cda6175a410a5d0dd9a7e8f10e2e043e012b5990
data/Gemfile CHANGED
@@ -2,5 +2,4 @@ source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'lock_jar'
6
5
  gem 'liquid-development'
data/Gemfile.lock CHANGED
@@ -1,17 +1,16 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- liquid-ext (2.0.2)
4
+ liquid-ext (3.0.0)
5
5
  activesupport
6
6
  erubis
7
- liquid-logging (>= 2.0.0)
8
7
  mixlib-cli
9
8
  terminal-table
10
9
 
11
10
  GEM
12
11
  remote: http://rubygems.org/
13
12
  specs:
14
- activesupport (4.0.2)
13
+ activesupport (4.0.3)
15
14
  i18n (~> 0.6, >= 0.6.4)
16
15
  minitest (~> 4.2)
17
16
  multi_json (~> 1.3)
@@ -19,7 +18,7 @@ GEM
19
18
  tzinfo (~> 0.3.37)
20
19
  atomic (1.1.14-java)
21
20
  awesome_print (1.2.0)
22
- bond (0.4.3-java)
21
+ bond (0.5.1-java)
23
22
  brice (0.2.9)
24
23
  ruby-nuggets (>= 0.5.2)
25
24
  cane (2.6.1)
@@ -27,21 +26,25 @@ GEM
27
26
  coderay (1.1.0)
28
27
  columnize (0.3.6)
29
28
  diff-lcs (1.2.5)
30
- docile (1.1.2)
29
+ docile (1.1.3)
31
30
  erubis (2.7.0)
32
31
  ffi (1.9.3-java)
33
32
  fuubar (1.3.2)
34
33
  rspec (>= 2.14.0, < 3.1.0)
35
34
  ruby-progressbar (~> 1.3)
35
+ hirb (0.7.1)
36
36
  i18n (0.6.9)
37
- liquid-development (0.1.2)
37
+ liquid-development (0.2.0)
38
38
  awesome_print
39
+ bond
39
40
  brice
40
41
  cane
41
42
  fuubar
43
+ hirb
42
44
  pry
43
45
  rake
44
46
  reek
47
+ rib
45
48
  ripl
46
49
  rspec
47
50
  ruby-debug
@@ -49,20 +52,12 @@ GEM
49
52
  tailor
50
53
  timecop
51
54
  yard
52
- liquid-logging (2.0.1-java)
53
- log4jruby (~> 1.0.0.rc1)
54
- slyphon-log4j (~> 1.2.15)
55
- lock_jar (0.7.5)
56
- naether (~> 0.10.1)
57
- thor (~> 0.18.1)
58
- log4jruby (1.0.0.rc1-java)
59
55
  log_switch (0.4.0)
60
56
  method_source (0.8.2)
61
57
  mini_portile (0.5.2)
62
58
  minitest (4.7.5)
63
59
  mixlib-cli (1.4.0)
64
60
  multi_json (1.8.4)
65
- naether (0.10.1-java)
66
61
  nokogiri (1.6.1-java)
67
62
  mini_portile (~> 0.5.0)
68
63
  parallel (0.9.2)
@@ -76,16 +71,16 @@ GEM
76
71
  ruby2ruby (~> 2.0.7)
77
72
  ruby_parser (~> 3.2)
78
73
  sexp_processor
79
- ripl (0.7.0)
80
- bond (~> 0.4.2)
74
+ rib (1.2.3)
75
+ ripl (0.1.0)
81
76
  rspec (2.14.1)
82
77
  rspec-core (~> 2.14.0)
83
78
  rspec-expectations (~> 2.14.0)
84
79
  rspec-mocks (~> 2.14.0)
85
80
  rspec-core (2.14.7)
86
- rspec-expectations (2.14.4)
81
+ rspec-expectations (2.14.5)
87
82
  diff-lcs (>= 1.1.3, < 2.0)
88
- rspec-mocks (2.14.4)
83
+ rspec-mocks (2.14.6)
89
84
  ruby-debug (0.10.4)
90
85
  columnize (>= 0.1)
91
86
  ruby-debug-base (~> 0.10.4.0)
@@ -95,7 +90,7 @@ GEM
95
90
  ruby2ruby (2.0.7)
96
91
  ruby_parser (~> 3.1)
97
92
  sexp_processor (~> 4.0)
98
- ruby_parser (3.3.0)
93
+ ruby_parser (3.4.1)
99
94
  sexp_processor (~> 4.1)
100
95
  sexp_processor (4.4.1)
101
96
  simplecov (0.8.2)
@@ -104,7 +99,6 @@ GEM
104
99
  simplecov-html (~> 0.8.0)
105
100
  simplecov-html (0.8.0)
106
101
  slop (3.4.7)
107
- slyphon-log4j (1.2.15)
108
102
  spoon (0.0.4)
109
103
  ffi
110
104
  tailor (1.4.0)
@@ -112,15 +106,14 @@ GEM
112
106
  nokogiri (>= 1.6.0)
113
107
  term-ansicolor (>= 1.0.5)
114
108
  text-table (>= 1.2.2)
115
- term-ansicolor (1.2.2)
116
- tins (~> 0.8)
109
+ term-ansicolor (1.3.0)
110
+ tins (~> 1.0)
117
111
  terminal-table (1.4.5)
118
112
  text-table (1.2.3)
119
- thor (0.18.1)
120
113
  thread_safe (0.1.3-java)
121
114
  atomic
122
115
  timecop (0.7.1)
123
- tins (0.13.1)
116
+ tins (1.0.0)
124
117
  tzinfo (0.3.38)
125
118
  yard (0.8.7.3)
126
119
 
@@ -130,4 +123,3 @@ PLATFORMS
130
123
  DEPENDENCIES
131
124
  liquid-development
132
125
  liquid-ext!
133
- lock_jar
data/bin/liquid CHANGED
@@ -5,9 +5,9 @@ ROOT = File.expand_path('../..', __FILE__)
5
5
  require 'bundler/setup'
6
6
  require 'liquid/boot'
7
7
 
8
- require 'liquid/generator'
8
+ require 'liquid/console'
9
9
 
10
- CLI.for(Liquid::Generator) do
10
+ CLI.for(Liquid::Console) do
11
11
  option :author,
12
12
  :short => '-a',
13
13
  :long => '--author',
@@ -4,6 +4,6 @@ module Benchmark
4
4
  def realtime(&block)
5
5
  timing = Timing.start
6
6
  yield
7
- timing.stop
7
+ timing.stop.to_f / 1_000_000_000
8
8
  end
9
9
  end
data/lib/liquid/boot.rb CHANGED
@@ -20,6 +20,11 @@ if RUBY_PLATFORM == 'java'
20
20
  # do nothing
21
21
  end
22
22
 
23
+ # load bundled jars
24
+ Dir[File.join(File.dirname(__FILE__), '*.jar')].each do |f|
25
+ require f
26
+ end
27
+
23
28
  # some java libraries cannot be found on maven central, so we load all bundled
24
29
  # jar files here for convenience
25
30
  if defined?(ROOT)
@@ -29,33 +34,41 @@ if RUBY_PLATFORM == 'java'
29
34
  end
30
35
  end
31
36
 
32
- # load default configuration
33
- require 'liquid-logging'
34
- require 'liquid/configuration'
35
-
36
- $conf = Configuration.new
37
+ # load a bunch of common classes here, so we don't have to track and repeat it
38
+ # everywhere
39
+ require 'active_support/all'
40
+ require 'cgi'
41
+ require 'date'
42
+ require 'json'
43
+ require 'socket'
44
+ require 'time'
37
45
 
38
- # configuration-reloading callbacks
39
- reload_logger = ->(conf) do
40
- ImprovedLogger::Formatter.format = conf.log_format
41
- ImprovedLogger::Formatter.log4j_format = conf.log4j_format
46
+ # load all extensions
47
+ Dir[File.join(File.dirname(__FILE__), 'ext', '*.rb')].each do |f|
48
+ require f
49
+ end
42
50
 
43
- $log = MultiLogger.new
44
- $log.attach(ImprovedLogger.new(conf.log_backend.to_sym, File.basename($0)))
45
- $log.level = conf.log_level.downcase.to_sym
46
- $log.log_caller = conf.log_caller
51
+ require 'liquid/benchmark'
52
+ require 'liquid/cli'
53
+ require 'liquid/environment'
54
+ require 'liquid/from_file'
55
+ require 'liquid/hash_helper'
56
+ require 'liquid/metrics'
57
+ require 'liquid/timing'
58
+ require 'liquid/transaction_id'
59
+ require 'liquid/zmq'
47
60
 
48
- # sneak this in automatically
49
- ZK.logger = $log if ::Module.const_defined?(:ZK)
61
+ # configuration callbacks
62
+ require 'liquid/logger'
63
+ reload_logger = ->(conf) do
64
+ $log = Liquid::Logger.new("root")
50
65
  end
51
66
 
52
67
  reload_mixins = ->(conf) do
53
68
  if defined?(ROOT)
54
69
  config_yml = File.join(ROOT, 'config.yml')
55
70
  conf.mixin(config_yml) if File.exist?(config_yml)
56
-
57
71
  dot_user = File.join(ROOT, '.user')
58
-
59
72
  if File.exists?(dot_user)
60
73
  File.readlines(dot_user).each do |line|
61
74
  user_yml = File.join(ROOT, 'config', 'mixins', "#{line.chomp}.yml")
@@ -65,30 +78,29 @@ reload_mixins = ->(conf) do
65
78
  end
66
79
  end
67
80
 
68
- # reload configuration, trigger callbacks
81
+ require 'liquid/configuration'
82
+ $conf = Liquid::Configuration.new
83
+
84
+ $conf.mixin({
85
+ generic: {
86
+ log: {
87
+ caller: false,
88
+ level: :info,
89
+ format: "%d{ISO8601} %-5p #{File.basename($0)}(#{Process.pid})[%t]: %m%n",
90
+ },
91
+ },
92
+ production: {
93
+ log: {
94
+ format: "[%t]: %m%n",
95
+ },
96
+ },
97
+ staging: {
98
+ log: {
99
+ format: "[%t]: %m%n",
100
+ },
101
+ },
102
+ })
103
+
69
104
  $conf.callback(&reload_mixins)
70
105
  $conf.callback(&reload_logger)
71
-
72
106
  $conf.reload!
73
-
74
- # load a bunch of common classes here, so we don't have to track and repeat it
75
- # everywhere
76
- require 'active_support/all'
77
- require 'cgi'
78
- require 'date'
79
- require 'json'
80
- require 'socket'
81
- require 'time'
82
-
83
- # load all extensions
84
- Dir[File.join(File.dirname(__FILE__), 'ext', '*.rb')].each do |f|
85
- require f
86
- end
87
-
88
- require 'liquid/benchmark'
89
- require 'liquid/cli'
90
- require 'liquid/environment'
91
- require 'liquid/from_file'
92
- require 'liquid/hash_helper'
93
- require 'liquid/timing'
94
- require 'liquid/transaction_id'
data/lib/liquid/cli.rb CHANGED
@@ -6,11 +6,6 @@ require 'mixlib/cli'
6
6
  class CLI
7
7
  include Mixlib::CLI
8
8
 
9
- option :configfile,
10
- short: '-c FILE',
11
- long: '--config FILE',
12
- description: 'Configuration File to load'
13
-
14
9
  option :name,
15
10
  :short => '-n NAME',
16
11
  :long => '--name NAME',
@@ -31,7 +26,7 @@ class CLI
31
26
  :description => "Enable debug output",
32
27
  :boolean => true,
33
28
  :default => false,
34
- :proc => ->(value) { $conf.mixin(log_level: value ? :debug : :info); value }
29
+ :proc => ->(value) { $conf.mixin(debug: value, log: { level: value ? :debug : :info }); value }
35
30
 
36
31
  option :help,
37
32
  :short => '-h',
@@ -7,152 +7,135 @@ require 'liquid/ext/hash'
7
7
  require 'liquid/ext/ordered_set'
8
8
  require 'liquid/environment'
9
9
 
10
- ##
11
- # A {Configuration} consists of one or more Sections. A section is a hash-like
12
- # object that responds to all keys in the hash as if they were methods:
13
- #
14
- # > s = Section.from_hash({:v1 => 2, :nested => {:v2 => 1}})
15
- # > s.v1
16
- # => 2
17
- # > s.nested.v2
18
- # => 1
19
- #
20
- class Section < Hash
21
-
22
- class << self
23
-
24
- # How to handle nil values in the configuration?
25
- #
26
- # Possible values are:
27
- # - :nil, nil (return nil)
28
- # - :raise (raise an exception)
29
- # - :section (return a NilSection which can be chained)
30
- #
31
- attr_accessor :nil_action
10
+ module Liquid
11
+ ##
12
+ # Am {Configuration} consists of one or more Sections. A section is a hash-like
13
+ # object that responds to all keys in the hash as if they were methods:
14
+ #
15
+ # > s = Section.from_hash({:v1 => 2, :nested => {:v2 => 1}})
16
+ # > s.v1
17
+ # => 2
18
+ # > s.nested.v2
19
+ # => 1
20
+ #
21
+ class Section < Hash
22
+
23
+ class << self
24
+
25
+ # How to handle nil values in the configuration?
26
+ #
27
+ # Possible values are:
28
+ # - :nil, nil (return nil)
29
+ # - :raise (raise an exception)
30
+ # - :section (return a NilSection which can be chained)
31
+ #
32
+ attr_accessor :nil_action
33
+
34
+ # Create a new section from the given hash-like object.
35
+ #
36
+ # @param [Hash] hsh The hash to convert into a section.
37
+ # @return [Section] The new {Section} object.
38
+ def from_hash(hsh)
39
+ new.tap do |result|
40
+ hsh.each do |key, value|
41
+ result[key.to_sym] = from_value(value)
42
+ end
43
+ end
44
+ end
32
45
 
33
- # Create a new section from the given hash-like object.
34
- #
35
- # @param [Hash] hsh The hash to convert into a section.
36
- # @return [Section] The new {Section} object.
37
- def from_hash(hsh)
38
- new.tap do |result|
39
- hsh.each do |key, value|
40
- result[key.to_sym] = from_value(value)
46
+ # Convert the given value into a Section, list of Sections or the pure
47
+ # value. Used to recursively build the Section hash.
48
+ #
49
+ # @private
50
+ def from_value(value)
51
+ case value
52
+ when Hash
53
+ from_hash(value)
54
+ when Array
55
+ value.map do |item|
56
+ from_value(item)
57
+ end
58
+ else
59
+ value
41
60
  end
42
61
  end
62
+
43
63
  end
44
64
 
45
- # Convert the given value into a Section, list of Sections or the pure
46
- # value. Used to recursively build the Section hash.
47
- #
48
65
  # @private
49
- def from_value(value)
50
- case value
51
- when Hash
52
- from_hash(value)
53
- when Array
54
- value.map do |item|
55
- from_value(item)
56
- end
66
+ def method_missing(name, *args)
67
+ if name.to_s =~ /(.*)=$/
68
+ self[$1.to_sym] = Section.from_value(args.first)
57
69
  else
58
- value
70
+ value = self[name]
71
+ self[name] = value.call if value.is_a?(Proc)
72
+ self[name]
59
73
  end
60
74
  end
61
-
62
- end
63
-
64
- # @private
65
- def method_missing(name, *args)
66
- if name.to_s =~ /(.*)=$/
67
- self[$1.to_sym] = Section.from_value(args.first)
68
- else
69
- value = self[name]
70
- self[name] = value.call if value.is_a?(Proc)
71
- self[name]
72
- end
73
75
  end
74
- end
75
76
 
76
- ##
77
- # The Configuration class provides a simple interface to configuration stored
78
- # inside of YAML files.
79
- #
80
- class Configuration < Section
81
-
82
- DEFAULTS = {
83
- generic: {
84
- log_backend: :stdout,
85
- log_caller: false,
86
- log_level: :info,
87
- log_format: "%{time} %{progname}(%{pid}) [%{severity}] %{msg}\n",
88
- log4j_format: "%d %c(%t) [%p] %m%n",
89
- },
90
- production: {
91
- log_format: "%{msg}\n",
92
- log4j_format: "%m%n",
93
- },
94
- staging: {
95
- log_format: "%{msg}\n",
96
- log4j_format: "%m%n",
97
- },
98
- }
99
-
100
- # Create a new {Configuration} object.
77
+ ##
78
+ # The Configuration class provides a simple interface to configuration stored
79
+ # inside of YAML files.
101
80
  #
102
- # @yield [config] The new configuration object.
103
- def initialize
104
- @mixins = OrderedSet.new
105
- @callbacks = []
106
- mixin(DEFAULTS)
107
- end
81
+ class Configuration < Section
108
82
 
109
- # Mixin a configuration snippet into the current section.
110
- #
111
- # @param [Hash, String] value A hash to merge into the current
112
- # configuration. If a string is given a filename
113
- # is assumed and the given file is expected to
114
- # contain a YAML hash.
115
- # @return [void]
116
- def mixin(value)
117
- @mixins << value
118
-
119
- if value.is_a?(String)
120
- value = YAML.load(File.read(value))
83
+ # Create a new {Configuration} object.
84
+ #
85
+ # @yield [config] The new configuration object.
86
+ def initialize
87
+ @mixins = OrderedSet.new
88
+ @callbacks = []
121
89
  end
122
90
 
123
- return unless value
91
+ # Mixin a configuration snippet into the current section.
92
+ #
93
+ # @param [Hash, String] value A hash to merge into the current
94
+ # configuration. If a string is given a filename
95
+ # is assumed and the given file is expected to
96
+ # contain a YAML hash.
97
+ # @return [void]
98
+ def mixin(value)
99
+ @mixins << value
100
+
101
+ if value.is_a?(String)
102
+ value = YAML.load(File.read(value))
103
+ end
104
+
105
+ return unless value
124
106
 
125
- value = Section.from_hash(value)
107
+ value = Section.from_hash(value)
126
108
 
127
- deep_merge!(value[:generic]) if value.has_key?(:generic)
109
+ deep_merge!(value[:generic]) if value.has_key?(:generic)
128
110
 
129
- if value.has_key?(Env.to_sym)
130
- deep_merge!(value[Env.to_sym])
131
- else
132
- deep_merge!(value)
111
+ if value.has_key?(Env.to_sym)
112
+ deep_merge!(value[Env.to_sym])
113
+ else
114
+ deep_merge!(value)
115
+ end
133
116
  end
134
- end
135
117
 
136
- # Reload all mixins.
137
- #
138
- # @return [void]
139
- def reload!
140
- clear
118
+ # Reload all mixins.
119
+ #
120
+ # @return [void]
121
+ def reload!
122
+ clear
123
+
124
+ @mixins.each do |file|
125
+ mixin(file)
126
+ end
141
127
 
142
- @mixins.each do |file|
143
- mixin(file)
128
+ @callbacks.each do |callback|
129
+ callback.call(self)
130
+ end
144
131
  end
145
132
 
146
- @callbacks.each do |callback|
147
- callback.call(self)
133
+ # Register a callback for config mixins.
134
+ #
135
+ # @return [void]
136
+ def callback(&block)
137
+ @callbacks << block
148
138
  end
149
- end
150
139
 
151
- # Register a callback for config mixins.
152
- #
153
- # @return [void]
154
- def callback(&block)
155
- @callbacks << block
156
140
  end
157
-
158
141
  end
@@ -1,13 +1,20 @@
1
1
  require 'erubis'
2
2
  require 'mixlib/cli'
3
+ require 'rib/runner'
4
+ require 'rib/all'
3
5
 
4
6
  module Liquid
5
- class Generator
7
+ class Console
6
8
 
7
9
  def run
8
10
  self.__send__(ARGV.shift, *ARGV)
9
11
  end
10
12
 
13
+ def console(*args)
14
+ require 'liquid/boot'
15
+ Rib::Runner.run(args)
16
+ end
17
+
11
18
  def project(name)
12
19
  if File.exist?(name)
13
20
  puts "!!! #{name} already exists"
@@ -1,3 +1,11 @@
1
1
  class String
2
2
  alias each each_line
3
+
4
+ def clean_quote
5
+ if index(/["\s]/)
6
+ %{"#{tr('"', "'")}"}
7
+ else
8
+ self
9
+ end
10
+ end
3
11
  end
@@ -14,4 +14,10 @@ class Thread
14
14
  end
15
15
  end
16
16
 
17
+ def self.join
18
+ Thread.list.reject do |thread|
19
+ thread == Thread.current
20
+ end.each(&:join)
21
+ end
22
+
17
23
  end
Binary file
@@ -1,18 +1,13 @@
1
- require 'singleton'
1
+ require 'liquid/logger'
2
2
 
3
+ require_relative './metrics-healthchecks-3.0.1.jar'
3
4
  java_import 'com.codahale.metrics.health.HealthCheckRegistry'
4
5
 
5
6
  class HealthChecks
6
- include Singleton
7
-
8
- attr_reader :registry
9
-
10
- def initialize
11
- @registry = HealthCheckRegistry.new
12
- end
7
+ @registry = HealthCheckRegistry.new
13
8
 
14
9
  def self.registry
15
- instance.registry
10
+ @registry
16
11
  end
17
12
 
18
13
  def self.register(name, handler)
@@ -22,5 +17,4 @@ class HealthChecks
22
17
  def self.run
23
18
  registry.run_health_checks
24
19
  end
25
-
26
20
  end
Binary file
Binary file
Binary file