system_health 0.0.8 → 0.0.9

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: 02c8f10c789589d9abbf508df45a999669078ac2
4
- data.tar.gz: 4345ed99e704e61313d7d49a547b94df92970664
3
+ metadata.gz: d46611b2952413881bc6835fc6346b1402a37184
4
+ data.tar.gz: e212f39b22d9953e4ad666f2641a20d36c7d379d
5
5
  SHA512:
6
- metadata.gz: 33e7b601530912039ab5bd375be38564727652f42005a449b44101508768e617f5c1fc7716c0557135e826be2d96684dbb87c23cefded7837e58e664494c5b99
7
- data.tar.gz: bf692fcb93e96ee7327bdec30e5298f3e7bcbd35c02a906ba8329c4d21cc9ead7995e58400f428259259f46ec9bb57ae42db128f83788cf5b26de5004c83db91
6
+ metadata.gz: 8126d5f48e50ffe19475d5a5d450dbe254b247b4e3979ff07a28e5f0899b65776fa05e5a6ec5399586eae76530110982437019b307298607a325fcebf739b7ef
7
+ data.tar.gz: e37475da47ef504d25037d600957d2f4bbd55012f0d4569916fe489146a02854e331c992dc18b284bd9ac4235fa267e3529f88d1ca4cb4419695927d540176c0
data/README.md CHANGED
@@ -20,79 +20,80 @@ Or install it yourself as:
20
20
 
21
21
  and then...
22
22
 
23
- 1. Create your monitor classes
23
+ ### Create your monitor classes
24
24
 
25
- All monitoring classes require a public instance method named `description`.
26
- This method should return a string describing the bad data condition that is
27
- being tested.
25
+ All monitoring classes require a public instance method named `description`.
26
+ This method should return a string describing the bad data condition that is
27
+ being tested.
28
28
 
29
- ## Generic monitoring class
29
+ #### Generic monitoring class
30
30
 
31
- For example, in lib/system_health/monitors/bad_data.rb create:
31
+ For example, in lib/system_health/monitors/bad_data.rb create:
32
32
 
33
- ```ruby
34
- module SystemHealth
35
- module Monitors
36
- class BadData < Base
37
- def description
38
- 'Bad data was discovered'
39
- end
33
+ ```ruby
34
+ module SystemHealth
35
+ module Monitors
36
+ class BadData < Base
37
+ def description
38
+ 'Bad data was discovered'
39
+ end
40
40
 
41
- private
41
+ private
42
42
 
43
- def bad_data?
44
- # return true from this method if there is bad data
45
- end
43
+ def bad_data?
44
+ # return true from this method if there is bad data
46
45
  end
47
46
  end
48
47
  end
49
- ```
48
+ end
49
+ ```
50
50
 
51
- define a private instance method `bad_data?` that should return true
52
- when bad data exists.
51
+ the private instance method `bad_data?` should return true
52
+ when bad data exists. Note: this class inherits from `Base`.
53
53
 
54
- ## SQL monitoring class
54
+ #### SQL monitoring class
55
55
 
56
- For example, in lib/system_health/monitors/bad_sql_data.rb create:
56
+ For example, in lib/system_health/monitors/bad_sql_data.rb create:
57
57
 
58
- ```ruby
59
- module SystemHealth
60
- module Monitors
61
- class BadSqlData < Sql
62
- def description
63
- 'Bad data was discovered through a SQL query'
64
- end
58
+ ```ruby
59
+ module SystemHealth
60
+ module Monitors
61
+ class BadSqlData < Sql
62
+ def description
63
+ 'Bad data was discovered through a SQL query'
64
+ end
65
65
 
66
- private
66
+ private
67
67
 
68
- def sql
69
- <<-SQL
70
- SELECT *
71
- FROM some_table
72
- WHERE bad_data is true
73
- SQL
74
- end
68
+ def sql
69
+ <<-SQL
70
+ SELECT *
71
+ FROM some_table
72
+ WHERE bad_data is true
73
+ SQL
75
74
  end
76
75
  end
77
76
  end
78
- ```
77
+ end
78
+ ```
79
79
 
80
- this type of monitor requires an additional private instance method
81
- named `sql`. This SQL statement should return rows for any data
82
- integrity problem. I.e. no rows means no problem. Rows returned means
83
- there is a problem.
80
+ the private instance method `sql` should include the string version of
81
+ the SQL to use in the system health check. This SQL should return rows
82
+ when there is bad data. I.e. no rows returned means no system health problem.
83
+ Rows returned means there is a problem. Note: this class inherits from
84
+ `Sql`.
84
85
 
85
86
 
86
- 2. create an initializer in config/initializers/system_health.rb
87
+ ### Create an initializer in config/initializers/system_health.rb
87
88
 
88
- ```ruby
89
- SystemHealth.configure do |config|
90
- config.monitor_classes = [
91
- SystemHealth::Monitors::BadData,
92
- SystemHealth::Monitors::BadSqlData
93
- ]
94
- end
95
- ```
89
+ ```ruby
90
+ SystemHealth.configure do |config|
91
+ config.monitor_classes = [
92
+ SystemHealth::Monitors::BadData,
93
+ SystemHealth::Monitors::BadSqlData
94
+ ]
95
+ end
96
+ ```
96
97
 
97
98
  ## Usage
98
99
 
@@ -106,6 +107,16 @@ mon.error_messages
106
107
  mon.error_count
107
108
  ```
108
109
 
110
+ by default SystemHealth::Monitor.new uses those classes defined in your
111
+ initializer but you can initialize with your own classes, if you wish:
112
+
113
+ ```ruby
114
+ mon =
115
+ SystemHealth::Monitor.new([SystemMonitor::Monitors::SomeSpecialClass])
116
+ mon.error_messages
117
+ mon.error_count
118
+ ```
119
+
109
120
  ## To do?
110
121
 
111
122
  1. Add concept of notifiers to make it more seamless to email or report
@@ -1,3 +1,3 @@
1
1
  module SystemHealth
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: system_health
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stirling Olson