bidu-house 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +65 -2
- data/lib/bidu/house/concern.rb +1 -1
- data/lib/bidu/house/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61df7ae9ad7055e431d7912230db3f33cd23c672
|
4
|
+
data.tar.gz: 6e2d298063bbd83ffa628bf2da57bb314a468d47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fbf8718e925ea3e3d005e5178a940c32ddcbbc76edd3900693221b6144beae7ed9b430b28321f96dcb09f74e302a415b3b77082dca36a80b631bf1c3cbe977b
|
7
|
+
data.tar.gz: 090601be4bbd3711920ea90fcea1853da102bd033b468ccb955ffa3ecd05aaad8d529b5aaa4f5cf11cb5eafdf42392c91d69e2d2b76a65dfcc737864d25b66a2
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,2 +1,65 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
Bidu House
|
2
|
+
==========
|
3
|
+
|
4
|
+
This gem tries to make server monitoring easier and more reliable by adding an easly configurable
|
5
|
+
report and making it avaliable in a controller
|
6
|
+
|
7
|
+
Getting started
|
8
|
+
---------------
|
9
|
+
1. Add JsonParser to your `Gemfile` and `bundle install`:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'json_parser'
|
13
|
+
```
|
14
|
+
|
15
|
+
|
16
|
+
2. Include in your health check controller passing the configuration to fetch your Documents
|
17
|
+
with error and render the report
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
class HealthCheckController < ApplicationController
|
21
|
+
include Bidu::House
|
22
|
+
|
23
|
+
status_report :failures, clazz: Document
|
24
|
+
status_report :failures, clazz: Schedules, on: :schedules
|
25
|
+
status_report :delays, clazz: Schedules, scope: :late, on: :schedules
|
26
|
+
|
27
|
+
def status
|
28
|
+
render_status
|
29
|
+
end
|
30
|
+
|
31
|
+
def late_status
|
32
|
+
render_status(:schedules)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
3. Add a route to your controller
|
38
|
+
|
39
|
+
```ruby
|
40
|
+
scope path: 'health-check', controller: :health_check do
|
41
|
+
get '/status' => :status
|
42
|
+
get '/late-status' => :late_status
|
43
|
+
end
|
44
|
+
```
|
45
|
+
|
46
|
+
3. Set the correct options on your status report to achieve a perfect report
|
47
|
+
- clazz: Class of the object that might contain error
|
48
|
+
- scope: scope to be fetched when trying to find objects with error (default: :with_error)
|
49
|
+
- external_key: column to be exposed as id for the objects with error
|
50
|
+
- threshold: default report threshold (default: 0.02)
|
51
|
+
- period: default search period (default: 1 day)
|
52
|
+
- on: report bucket (default: :default)
|
53
|
+
|
54
|
+
4. Run the server and hit the health-check routes
|
55
|
+
|
56
|
+
```
|
57
|
+
wget http://localhost:3000/health-check/status
|
58
|
+
wget http://localhost:3000/health-check/late-status
|
59
|
+
```
|
60
|
+
|
61
|
+
5. Customize your request for multiple reports
|
62
|
+
```
|
63
|
+
wget http://localhost:3000/health-check/status?period=3.days&threshold=0.005
|
64
|
+
wget http://localhost:3000/health-check/late-status?period=1.hours&threshold=0.1
|
65
|
+
```
|
data/lib/bidu/house/concern.rb
CHANGED
data/lib/bidu/house/version.rb
CHANGED