cepa-health 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +20 -11
- data/lib/cepa-health/version.rb +1 -1
- data/probes/delayed_job.rb +3 -3
- metadata +11 -17
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4041317b20a2ee2cc43249fa1ccd0e29db5bc033
|
4
|
+
data.tar.gz: 0768548949477e6e34b8633a832cfaf63ef813cb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c5bdb8092e758f61554920a20fbfa0efca31e305abe1717fd75f406bdaaa0570da1d2bb3540d76e705b2fe2eca2f1d0fe4ac896deb5ad0e6ed354373573da4ae
|
7
|
+
data.tar.gz: 5b36f80680a729c0575694ed4087e12ae0e1880a02dff77185d52dc126cb3e8de69ce95b3008f65e2dc5a462d8a0526780e8396832f0b6480b0351d2c0736beb
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ any probe fails.
|
|
8
8
|
|
9
9
|
This path is intended for use by services such as
|
10
10
|
[Pingdom](https://www.pingdom.com/) or [New Relic](http://newrelic.com/).
|
11
|
-
This path is also for use with Load
|
11
|
+
This path is also for use with Load Balancers that use a health check, such as
|
12
12
|
Amazon's [Elastic Load Balancer](http://aws.amazon.com/elasticloadbalancing/).
|
13
13
|
|
14
14
|
See Discussion before for more details on the use of Cepa Health.
|
@@ -44,30 +44,39 @@ Alternatively, if you're running a Rack-based application (e.g. using
|
|
44
44
|
To define probes, register blocks as:
|
45
45
|
|
46
46
|
# Create a Probe with the default level of "error"
|
47
|
-
CepaHealth.register
|
47
|
+
CepaHealth.register do
|
48
48
|
record("Other result", true, "This will add another reporting row")
|
49
|
-
true # Ultimate result
|
49
|
+
["My Error Probe", true, "Comment"] # Ultimate result of the probe
|
50
50
|
end
|
51
51
|
|
52
52
|
# Create a Probe specifically tagged as level "warn"
|
53
|
-
CepaHealth.register
|
53
|
+
CepaHealth.register :warn do
|
54
54
|
record("Other result", true, "This will add another reporting row")
|
55
|
-
|
55
|
+
["My Warning Probe", true, "Comment"] # Ultimate result of the probe
|
56
56
|
end
|
57
57
|
|
58
|
-
The result of these Probes is summarized at the `/healthy` path when you run
|
59
|
-
|
60
|
-
|
58
|
+
The result of these Probes is summarized at the `/healthy` path when you run
|
59
|
+
your Rack application. This will render a HTML table, you can similarly use
|
60
|
+
`/healthy.json` or `healthy.txt` for JSON and Text results respectively. Take
|
61
|
+
a look at the [probes directory](https://github.com/jonathannen/cepa-health/tree/master/probes)
|
62
|
+
for some examples of probes.
|
61
63
|
|
62
|
-
By default, `/healthy` will return all probes. You can cut this back using
|
64
|
+
By default, `/healthy` will return all probes. You can cut this back using
|
65
|
+
filters. For example, `healthy.txt?filters=warn` will return a Text summary
|
66
|
+
of just the "warn" level Probes. `healthy.txt?filters=error,warn` returns both
|
67
|
+
"error" and "warn" probes.
|
63
68
|
|
64
69
|
## Privacy
|
65
70
|
|
66
|
-
You may not want your health check available to anyone - either because you
|
71
|
+
You may not want your health check available to anyone - either because you
|
72
|
+
want to be private about the results, or you don't want to unnecessarily reveal
|
73
|
+
details of your stack. To provide an extra layer of privacy, you can set a key
|
74
|
+
on your health check. Just add (or comment out in the initalizer):
|
67
75
|
|
68
76
|
CepaHealth.key = "sekret"
|
69
77
|
|
70
|
-
The health check will only be available if `key=sekret` is added to the path.
|
78
|
+
The health check will only be available if `key=sekret` is added to the path.
|
79
|
+
If it doesn't match, a blank 404 is returned.
|
71
80
|
|
72
81
|
This will prevent casual access to your health check.
|
73
82
|
|
data/lib/cepa-health/version.rb
CHANGED
data/probes/delayed_job.rb
CHANGED
@@ -8,13 +8,13 @@ if defined?(Delayed)
|
|
8
8
|
record "Delayed Job Backlog", true, Delayed::Job.count
|
9
9
|
|
10
10
|
# Detect if the DJ backend is ActiveRecord or Mongoid Based
|
11
|
-
type = case
|
11
|
+
type = case
|
12
12
|
when Delayed::Job.respond_to?(:order_by) then :mongoid
|
13
13
|
when Delayed::Job.respond_to?(:order) then :active_record
|
14
14
|
else nil
|
15
15
|
end
|
16
16
|
|
17
|
-
# Maximum Delayed Job age is
|
17
|
+
# Maximum Delayed Job age is an hour
|
18
18
|
unless type.nil?
|
19
19
|
query = type == :active_record ? Delayed::Job.order("run_at DESC") : Delayed::Job.order_by(:run_at.desc)
|
20
20
|
value = query.last
|
@@ -22,7 +22,7 @@ if defined?(Delayed)
|
|
22
22
|
record 'Delayed Job Backlog Age', true, 'No expired jobs'
|
23
23
|
else
|
24
24
|
diff = (now - value.run_at)
|
25
|
-
record 'Delayed Job Backlog Age', diff <
|
25
|
+
record 'Delayed Job Backlog Age', diff < 3600, "#{'%.1f' % (diff/60)} mins"
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cepa-health
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jon Williams
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-11-20 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rack
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 1.2.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 1.2.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 2.0.0
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 2.0.0
|
46
41
|
description: Health Check Middleware for Rails and Rack-based Applications
|
@@ -70,27 +65,26 @@ files:
|
|
70
65
|
homepage: https://github.com/jonathannen/cepa-health
|
71
66
|
licenses:
|
72
67
|
- MIT
|
68
|
+
metadata: {}
|
73
69
|
post_install_message:
|
74
70
|
rdoc_options: []
|
75
71
|
require_paths:
|
76
72
|
- lib
|
77
73
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
74
|
requirements:
|
80
|
-
- -
|
75
|
+
- - '>='
|
81
76
|
- !ruby/object:Gem::Version
|
82
77
|
version: '0'
|
83
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
79
|
requirements:
|
86
|
-
- -
|
80
|
+
- - '>='
|
87
81
|
- !ruby/object:Gem::Version
|
88
82
|
version: '0'
|
89
83
|
requirements: []
|
90
84
|
rubyforge_project:
|
91
|
-
rubygems_version:
|
85
|
+
rubygems_version: 2.0.3
|
92
86
|
signing_key:
|
93
|
-
specification_version:
|
87
|
+
specification_version: 4
|
94
88
|
summary: Provides the facility for probes that are evaluated when a health URL is
|
95
89
|
accessed.
|
96
90
|
test_files:
|