liquid-ext 3.4.2 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/lib/liquid/boot.rb +3 -0
- data/lib/liquid/configuration.rb +1 -1
- data/lib/liquid/health_checks.rb +1 -1
- data/lib/liquid/metrics.rb +8 -3
- data/lib/liquid/metrics/reporter.rb +1 -1
- data/lib/liquid/server.rb +35 -2
- data/liquid-ext.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1eb7c79616fa8b96ebb46d0dbff36b696b54896
|
4
|
+
data.tar.gz: bf5333639d97bf2c6b7842d0d3cff015cac441af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ed90f105bc6ae3888833d2f03a3161ff639d46715a41cf4b54a71a322decdd3c5f90f369f4e3b76563051d6551f3c0c99a543108d2eedf042f6802161d1d6f8
|
7
|
+
data.tar.gz: a0ee19cd66b5906d89d50fb4437fd42db27084be22b8f5fa98633d6237b718ea11550f2d41360da11691309168917d910193d83b274b62596bb74bb00897ff60
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
liquid-ext (3.
|
4
|
+
liquid-ext (3.5.0)
|
5
5
|
activesupport
|
6
6
|
erubis
|
7
7
|
jmx4r
|
@@ -57,7 +57,7 @@ GEM
|
|
57
57
|
method_source (0.8.2)
|
58
58
|
minitest (5.3.4)
|
59
59
|
mixlib-cli (1.5.0)
|
60
|
-
multi_json (1.10.
|
60
|
+
multi_json (1.10.1)
|
61
61
|
nokogiri (1.6.2.1-java)
|
62
62
|
parallel (1.0.0)
|
63
63
|
pry (0.9.12.6-java)
|
data/lib/liquid/boot.rb
CHANGED
data/lib/liquid/configuration.rb
CHANGED
@@ -106,7 +106,7 @@ module Liquid
|
|
106
106
|
|
107
107
|
value = Section.from_hash(value)
|
108
108
|
|
109
|
-
deep_merge!(value
|
109
|
+
deep_merge!(value.delete(:generic)) if value.has_key?(:generic)
|
110
110
|
|
111
111
|
if value.has_key?(Env.to_sym)
|
112
112
|
deep_merge!(value[Env.to_sym])
|
data/lib/liquid/health_checks.rb
CHANGED
data/lib/liquid/metrics.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
if RUBY_PLATFORM == "java"
|
2
|
+
java_import 'com.codahale.metrics.Gauge'
|
2
3
|
java_import 'com.codahale.metrics.Histogram'
|
3
4
|
java_import 'com.codahale.metrics.JmxReporter'
|
4
5
|
java_import 'com.codahale.metrics.MetricRegistry'
|
@@ -12,9 +13,9 @@ if RUBY_PLATFORM == "java"
|
|
12
13
|
@registry = MetricRegistry.new
|
13
14
|
@reporters = []
|
14
15
|
|
15
|
-
def self.start
|
16
|
-
@period
|
17
|
-
@unit
|
16
|
+
def self.start
|
17
|
+
@period = $conf.metrics.interval
|
18
|
+
@unit = TimeUnit::SECONDS
|
18
19
|
JmxReporter.forRegistry(@registry).build.start
|
19
20
|
Signal.register_shutdown_handler { stop }
|
20
21
|
end
|
@@ -36,6 +37,10 @@ if RUBY_PLATFORM == "java"
|
|
36
37
|
@registry
|
37
38
|
end
|
38
39
|
|
40
|
+
def self.gauge(name, handler)
|
41
|
+
registry.register(name, handler)
|
42
|
+
end
|
43
|
+
|
39
44
|
def self.counter(name)
|
40
45
|
registry.counter(name)
|
41
46
|
end
|
data/lib/liquid/server.rb
CHANGED
@@ -4,9 +4,16 @@ if RUBY_PLATFORM == "java"
|
|
4
4
|
|
5
5
|
module Liquid
|
6
6
|
class Server
|
7
|
+
attr_reader :started_at
|
8
|
+
|
9
|
+
def name
|
10
|
+
@name ||= self.class.name.downcase.gsub(/::/, '.')
|
11
|
+
end
|
12
|
+
|
7
13
|
def initialize
|
8
|
-
|
9
|
-
$log.info("#{
|
14
|
+
@started_at = Time.now
|
15
|
+
$log.info("#{name} #{RUBY_DESCRIPTION}")
|
16
|
+
$log.info("#{name}", env: Env.mode)
|
10
17
|
Signal.register_shutdown_handler { System.exit(0) }
|
11
18
|
Signal.register_shutdown_handler { ZContext.destroy }
|
12
19
|
initialize_raven
|
@@ -41,9 +48,31 @@ if RUBY_PLATFORM == "java"
|
|
41
48
|
Signal.register_shutdown_handler { $tracker.shutdown }
|
42
49
|
end
|
43
50
|
|
51
|
+
class HealthGauge
|
52
|
+
include Gauge
|
53
|
+
|
54
|
+
def getValue
|
55
|
+
HealthCheck.healthy? ? 1 : 0
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class UptimeGauge
|
60
|
+
include Gauge
|
61
|
+
|
62
|
+
def initialize(server)
|
63
|
+
@server = server
|
64
|
+
end
|
65
|
+
|
66
|
+
def getValue
|
67
|
+
@server.uptime.to_i
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
44
71
|
def initialize_metrics
|
45
72
|
::Metrics.start
|
46
73
|
::Metrics::TrackerReporter.new($tracker.with_topic('metrics'))
|
74
|
+
::Metrics.gauge("#{name}.healthy", HealthGauge.new)
|
75
|
+
::Metrics.gauge("#{name}.uptime", UptimeGauge.new(self))
|
47
76
|
Signal.register_shutdown_handler { ::Metrics.stop }
|
48
77
|
end
|
49
78
|
|
@@ -67,6 +96,10 @@ if RUBY_PLATFORM == "java"
|
|
67
96
|
Thread.join
|
68
97
|
end
|
69
98
|
|
99
|
+
def uptime
|
100
|
+
Time.now - @started_at
|
101
|
+
end
|
102
|
+
|
70
103
|
end
|
71
104
|
end
|
72
105
|
end
|
data/liquid-ext.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: liquid-ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LiquidM, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|