rt_health_monitor 0.8.0.pre.rc1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Changelog.md +9 -0
- data/README.md +98 -69
- data/lib/health_monitor/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29ef2a8b6dbcb15e9907509cd8492093223ea64936b8defaf70c0d23da579303
|
4
|
+
data.tar.gz: 3cc46a14eb1eff4d33a21ee5577c11fc47bd92d2992aa6bb3f48bc0494861715
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fdd9ce1c136b4b0c94919922c701e8de13f24c8369ba9fe8c90c5c36642a9963f7f0c5a0e0dd78ea28dc0261a7be3d1696578868e24002146e9330e0cf6bd8d
|
7
|
+
data.tar.gz: c2c78c6dc7bec506708f6473bff73b8f064dfc6944790a6b626bcc81c7c3af4f7d0ccfbc085a7e242e9d35817463e99968bdcd7c5798ca66e989a148bc81992d
|
data/.gitignore
CHANGED
data/Changelog.md
CHANGED
@@ -2,6 +2,15 @@ Changelog
|
|
2
2
|
===
|
3
3
|
|
4
4
|
master
|
5
|
+
---
|
6
|
+
|
7
|
+
v0.8.0
|
8
|
+
---
|
9
|
+
|
10
|
+
- Renamed gem to `rt_health_monitor`. The directory names are still the same,
|
11
|
+
so you don't have to change your `require`s yet.
|
12
|
+
- Refactored HealthMonitor middleware
|
13
|
+
- The middleware now returns 503 instead of 200 if one of the checks failed.
|
5
14
|
|
6
15
|
v0.7.2
|
7
16
|
---
|
data/README.md
CHANGED
@@ -1,14 +1,26 @@
|
|
1
|
-
|
2
|
-
=======
|
1
|
+
# rt_health_monitor
|
3
2
|
|
4
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/rt_health_monitor.svg)](https://badge.fury.io/rb/rt_health_monitor)
|
5
4
|
|
6
|
-
|
7
|
-
=====
|
5
|
+
Get information about your applications health status easily.
|
8
6
|
|
9
|
-
|
7
|
+
## Installation
|
10
8
|
|
11
|
-
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'rt_health_monitor', require: 'health_monitor'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install rt_health_monitor
|
22
|
+
|
23
|
+
## Usage
|
12
24
|
|
13
25
|
Add the middleware to your config.
|
14
26
|
|
@@ -16,101 +28,118 @@ Add the middleware to your config.
|
|
16
28
|
|
17
29
|
Add to you Rails configuration (config/application.rb)
|
18
30
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
31
|
+
```ruby
|
32
|
+
module <ApplicationName>
|
33
|
+
class Application < Rails::Application
|
34
|
+
config.middleware.use ::HealthMonitorMiddleware, "your_application_name"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
```
|
24
38
|
|
25
39
|
### Sinatra
|
26
40
|
|
27
41
|
Add to config.ru
|
28
42
|
|
29
|
-
|
43
|
+
```ruby
|
44
|
+
use HealthMonitorMiddleware, "your_application_name"
|
45
|
+
```
|
30
46
|
|
31
47
|
### Padrino
|
32
48
|
|
33
49
|
Add to config/apps.rb
|
34
50
|
|
35
|
-
|
36
|
-
|
51
|
+
```ruby
|
52
|
+
Padrino.use(HealthMonitorMiddleware, "your_application_name")
|
53
|
+
```
|
37
54
|
|
38
55
|
## Configure your dependencies
|
39
56
|
|
40
|
-
Put into some place which is loaded on startup, like
|
57
|
+
Put into some place which is loaded on startup, like
|
58
|
+
`config/initializer/health_monitor_initializer.rb`
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
HealthMonitorMiddleware.add("simple", name: "MySQL") { User.where{id > 0}.limit(1) }
|
41
62
|
|
42
|
-
|
43
|
-
|
44
|
-
HealthMonitorMiddleware.add("service", name: 'some_service_name') { RestClient.get(File.join(service-url, 'healthmonitor')) }
|
63
|
+
HealthMonitorMiddleware.add("service", name: 'some_service_name') { RestClient.get(File.join(service-url, 'healthmonitor')) }
|
64
|
+
```
|
45
65
|
|
46
|
-
Simple-Monitor needs some block which returns true or false for up an down
|
66
|
+
Simple-Monitor needs some block which returns true or false for up an down
|
67
|
+
state. Service-Monitor needs an block which returns a complete status response
|
68
|
+
in JSON format. This may be just the health-monitor used by a service.
|
47
69
|
|
48
70
|
## Outcome
|
49
71
|
|
50
|
-
As soon as the middleware is configured and your application is running, you can
|
72
|
+
As soon as the middleware is configured and your application is running, you can
|
73
|
+
acess the health monitor status page adding 'health_monitor' to your url. It does
|
74
|
+
not depend on the given path.
|
51
75
|
|
52
|
-
http://your_application_url_with_some_path/
|
76
|
+
http://your_application_url_with_some_path/health_monitor
|
53
77
|
|
54
|
-
This would lead to the following output
|
78
|
+
This would lead to the following output:
|
55
79
|
|
80
|
+
```json
|
81
|
+
{
|
82
|
+
"status": "down",
|
83
|
+
"name": "my app",
|
84
|
+
"simple": [
|
56
85
|
{
|
57
|
-
status: "
|
58
|
-
name: "
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
name: "MySQL",
|
95
|
-
time: 0
|
96
|
-
}
|
97
|
-
]
|
98
|
-
},
|
99
|
-
time: 23.989439010620117
|
86
|
+
"status": "up",
|
87
|
+
"name": "MySQL",
|
88
|
+
"time": 0.2758502960205078
|
89
|
+
},
|
90
|
+
{
|
91
|
+
"status": "up",
|
92
|
+
"name": "Memcached",
|
93
|
+
"time": 1.4078617095947266
|
94
|
+
},
|
95
|
+
{
|
96
|
+
"status": "up",
|
97
|
+
"name": "Resque",
|
98
|
+
"time": 3.2737255096435547
|
99
|
+
}
|
100
|
+
],
|
101
|
+
"service": [
|
102
|
+
{
|
103
|
+
"status": "down",
|
104
|
+
"name": "routes",
|
105
|
+
"time": 1295.3431606292725
|
106
|
+
},
|
107
|
+
{
|
108
|
+
"status": "up",
|
109
|
+
"name": "appendix",
|
110
|
+
"info": {
|
111
|
+
"simple": [
|
112
|
+
{
|
113
|
+
"status": "up",
|
114
|
+
"name": "MongoDB",
|
115
|
+
"time": 6.000041961669922
|
116
|
+
},
|
117
|
+
{
|
118
|
+
"status": "up",
|
119
|
+
"name": "MySQL",
|
120
|
+
"time": 0
|
121
|
+
}
|
122
|
+
]
|
100
123
|
},
|
124
|
+
"time": 23.989439010620117
|
125
|
+
},
|
101
126
|
...
|
102
|
-
|
127
|
+
]
|
128
|
+
}
|
129
|
+
```
|
103
130
|
|
104
131
|
|
105
132
|
## Sidekiq Health Check Task
|
106
133
|
|
107
|
-
A task for performing a Sidekiq health check is also included. To use that, just
|
134
|
+
A task for performing a Sidekiq health check is also included. To use that, just
|
135
|
+
add the following line to your `Rakefile`
|
108
136
|
|
109
137
|
```ruby
|
110
138
|
require "health_monitor/rake_task"
|
111
139
|
```
|
112
140
|
|
113
|
-
You must have a `environment` task in your `Rakefile` which loads the
|
141
|
+
You must have a `environment` task in your `Rakefile` which loads the
|
142
|
+
environment. Rails already provides such a task.
|
114
143
|
|
115
144
|
A simple environment task looks like this:
|
116
145
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rt_health_monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.0
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fuehrlinger
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-04-
|
13
|
+
date: 2018-04-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rack
|
@@ -107,9 +107,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
|
-
- - "
|
110
|
+
- - ">="
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
112
|
+
version: '0'
|
113
113
|
requirements: []
|
114
114
|
rubyforge_project:
|
115
115
|
rubygems_version: 2.7.3
|