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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f2691ba3e4a43b932d5ba3770027da4f9c15ce1
4
- data.tar.gz: 827b28c6b28b3766a77250a3dec8678c74449044
3
+ metadata.gz: 61df7ae9ad7055e431d7912230db3f33cd23c672
4
+ data.tar.gz: 6e2d298063bbd83ffa628bf2da57bb314a468d47
5
5
  SHA512:
6
- metadata.gz: 1599973e3f184f9e0082a5b7c38971fa55296864d672722fcf4c04fde4984d7e4c99b24af7339b0433a3321462dde3fa595b6a2f8974b84349d23a5891f70203
7
- data.tar.gz: c2e980424aa1d6f5bfdd2ae75f59d1b40a074ab1613e53c066e536becea3fba553d4ecb15cb187c1b3cdb240ed21490504ea49cef4c925b6e27966292cfc6ff7
6
+ metadata.gz: 8fbf8718e925ea3e3d005e5178a940c32ddcbbc76edd3900693221b6144beae7ed9b430b28321f96dcb09f74e302a415b3b77082dca36a80b631bf1c3cbe977b
7
+ data.tar.gz: 090601be4bbd3711920ea90fcea1853da102bd033b468ccb955ffa3ecd05aaad8d529b5aaa4f5cf11cb5eafdf42392c91d69e2d2b76a65dfcc737864d25b66a2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bidu-house (0.1.1)
4
+ bidu-house (0.1.2)
5
5
  activesupport
6
6
  bidu-core_ext
7
7
  concern_builder
data/README.md CHANGED
@@ -1,2 +1,65 @@
1
- # house
2
- Health Check Gem
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
+ ```
@@ -2,7 +2,7 @@ module Bidu
2
2
  module House
3
3
  extend ActiveSupport::Concern
4
4
 
5
- def render_status(key)
5
+ def render_status(key = :default)
6
6
  status = self.class.status_builder.build(key, params)
7
7
  render json: status.as_json, status: status.status
8
8
  end
@@ -1,5 +1,5 @@
1
1
  module Bidu
2
2
  module House
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bidu-house
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bidu Dev's Team