rapporteur-load_check 1.1.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -0
- data/CHANGELOG.md +13 -1
- data/README.md +2 -2
- data/config/locales/en.yml +5 -0
- data/lib/rapporteur/load_check.rb +9 -2
- data/rapporteur-load_check.gemspec +2 -2
- data/spec/internal/db/combustion_test.sqlite +0 -0
- data/spec/requests/load_check_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- metadata +28 -7
- checksums.yaml +0 -15
data/.travis.yml
CHANGED
@@ -5,3 +5,8 @@ rvm:
|
|
5
5
|
- jruby
|
6
6
|
notifications:
|
7
7
|
email: false
|
8
|
+
campfire:
|
9
|
+
on_success: change
|
10
|
+
on_failure: always
|
11
|
+
rooms:
|
12
|
+
- secure: "AVi2J9hq3ZBvNt9/eDwslgGfqyhURtcoJFlHScOgffK+9woQOeJXDQcpqxxE\nto7C1lnRn8c0VE2Z0gP5CPZUzHrLnlqUYZkyL4BuHtO29HPgrYT1SPuc80zo\nFv6o0TEzBmOUDxlrmSq8PBZbW1PkBDHWmMf3Tcs/zNjaL6QglLY="
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,17 @@
|
|
4
4
|
|
5
5
|
* No significant changes.
|
6
6
|
|
7
|
+
## [2.0.0][v2.0.0] / 2013-05-31
|
8
|
+
|
9
|
+
* Add missing English locales.
|
10
|
+
* Add a halt! when the load is high. Because we don't want to overburden an
|
11
|
+
already dying machine.
|
12
|
+
|
13
|
+
### :boom: Backward incompatible changes
|
14
|
+
|
15
|
+
* Change the I18n key for an excessive load failure to
|
16
|
+
"rapporteur.errors.load.excessive".
|
17
|
+
|
7
18
|
## [1.1.0][v1.1.0] / 2013-05-30
|
8
19
|
|
9
20
|
* Allow adjustment of load failure threshold.
|
@@ -12,5 +23,6 @@
|
|
12
23
|
|
13
24
|
* Initial public release.
|
14
25
|
|
15
|
-
[unreleased]: https://github.com/codeschool/rapporteur-load_check/compare/
|
26
|
+
[unreleased]: https://github.com/codeschool/rapporteur-load_check/compare/v2.0.0...master
|
27
|
+
[v2.0.0]: https://github.com/codeschool/rapporteur-load_check/compare/v1.1.0...v2.0.0
|
16
28
|
[v1.1.0]: https://github.com/codeschool/rapporteur-load_check/compare/v1.0.0...v1.1.0
|
data/README.md
CHANGED
@@ -23,14 +23,14 @@ application configuration files or initializers, such as:
|
|
23
23
|
|
24
24
|
```ruby
|
25
25
|
# config/initializers/production.rb
|
26
|
-
Rapporteur
|
26
|
+
Rapporteur.add_check(Rapporteur::Checks::LoadCheck)
|
27
27
|
```
|
28
28
|
|
29
29
|
By default, a load value of 8 or greater triggers a failure. You can adjust
|
30
30
|
this value by passing the threshold to LoadCheck.new, like so:
|
31
31
|
|
32
32
|
```ruby
|
33
|
-
Rapporteur
|
33
|
+
Rapporteur.add_check(Rapporteur::Checks::LoadCheck.new(4))
|
34
34
|
```
|
35
35
|
|
36
36
|
The above would cause the checker to fail if load goes above 4.0.
|
@@ -3,6 +3,8 @@ require "rapporteur"
|
|
3
3
|
|
4
4
|
module Rapporteur
|
5
5
|
module Checks
|
6
|
+
LoadCheckEngine = Class.new(Rails::Engine)
|
7
|
+
|
6
8
|
class LoadCheck
|
7
9
|
extend FFI::Library
|
8
10
|
|
@@ -21,8 +23,13 @@ module Rapporteur
|
|
21
23
|
|
22
24
|
def call(checker)
|
23
25
|
loadavg = self.class.current_load
|
24
|
-
|
25
|
-
|
26
|
+
|
27
|
+
if loadavg > @tolerance
|
28
|
+
checker.add_error(:load, :excessive, tolerance: @tolerance, value: loadavg)
|
29
|
+
checker.halt!
|
30
|
+
else
|
31
|
+
checker.add_message(:load, loadavg)
|
32
|
+
end
|
26
33
|
end
|
27
34
|
|
28
35
|
def self.call(checker)
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "rapporteur-load_check"
|
7
|
-
spec.version = "
|
7
|
+
spec.version = "2.0.0"
|
8
8
|
spec.authors = ["Envy Labs", "Code School"]
|
9
9
|
spec.email = [""]
|
10
10
|
spec.description = %q{Machine load reporting for rapporteur}
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_dependency "ffi"
|
21
|
-
spec.add_dependency "rapporteur", "~>
|
21
|
+
spec.add_dependency "rapporteur", "~> 2.0"
|
22
22
|
|
23
23
|
spec.add_development_dependency "combustion", "~> 0.5"
|
24
24
|
spec.add_development_dependency "rails", "~> 3.1"
|
Binary file
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe 'A status request with a LoadCheck' do
|
4
4
|
before do
|
5
|
-
Rapporteur
|
5
|
+
Rapporteur.add_check(Rapporteur::Checks::LoadCheck)
|
6
6
|
Rapporteur::Checks::LoadCheck.stub(:current_load).and_return(current_load)
|
7
7
|
end
|
8
8
|
|
@@ -15,7 +15,7 @@ describe 'A status request with a LoadCheck' do
|
|
15
15
|
|
16
16
|
it 'contains the load value in the messages' do
|
17
17
|
json = JSON.parse(subject.body)
|
18
|
-
expect(json
|
18
|
+
expect(json.fetch("load")).to eq(1.0)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -25,7 +25,7 @@ describe 'A status request with a LoadCheck' do
|
|
25
25
|
it_behaves_like 'an erred status response'
|
26
26
|
|
27
27
|
it 'contains a message regarding the excess load' do
|
28
|
-
expect(subject).to include_status_error_message(I18n.t('
|
28
|
+
expect(subject).to include_status_error_message(:load, I18n.t('rapporteur.errors.load.excessive', value: current_load, tolerance: 8.0))
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapporteur-load_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Envy Labs
|
@@ -9,11 +10,12 @@ authors:
|
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
13
|
+
date: 2013-05-31 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: ffi
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
17
19
|
requirements:
|
18
20
|
- - ! '>='
|
19
21
|
- !ruby/object:Gem::Version
|
@@ -21,6 +23,7 @@ dependencies:
|
|
21
23
|
type: :runtime
|
22
24
|
prerelease: false
|
23
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
24
27
|
requirements:
|
25
28
|
- - ! '>='
|
26
29
|
- !ruby/object:Gem::Version
|
@@ -28,20 +31,23 @@ dependencies:
|
|
28
31
|
- !ruby/object:Gem::Dependency
|
29
32
|
name: rapporteur
|
30
33
|
requirement: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
31
35
|
requirements:
|
32
36
|
- - ~>
|
33
37
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
38
|
+
version: '2.0'
|
35
39
|
type: :runtime
|
36
40
|
prerelease: false
|
37
41
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
38
43
|
requirements:
|
39
44
|
- - ~>
|
40
45
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
46
|
+
version: '2.0'
|
42
47
|
- !ruby/object:Gem::Dependency
|
43
48
|
name: combustion
|
44
49
|
requirement: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
45
51
|
requirements:
|
46
52
|
- - ~>
|
47
53
|
- !ruby/object:Gem::Version
|
@@ -49,6 +55,7 @@ dependencies:
|
|
49
55
|
type: :development
|
50
56
|
prerelease: false
|
51
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
52
59
|
requirements:
|
53
60
|
- - ~>
|
54
61
|
- !ruby/object:Gem::Version
|
@@ -56,6 +63,7 @@ dependencies:
|
|
56
63
|
- !ruby/object:Gem::Dependency
|
57
64
|
name: rails
|
58
65
|
requirement: !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
59
67
|
requirements:
|
60
68
|
- - ~>
|
61
69
|
- !ruby/object:Gem::Version
|
@@ -63,6 +71,7 @@ dependencies:
|
|
63
71
|
type: :development
|
64
72
|
prerelease: false
|
65
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
66
75
|
requirements:
|
67
76
|
- - ~>
|
68
77
|
- !ruby/object:Gem::Version
|
@@ -70,6 +79,7 @@ dependencies:
|
|
70
79
|
- !ruby/object:Gem::Dependency
|
71
80
|
name: rake
|
72
81
|
requirement: !ruby/object:Gem::Requirement
|
82
|
+
none: false
|
73
83
|
requirements:
|
74
84
|
- - ! '>='
|
75
85
|
- !ruby/object:Gem::Version
|
@@ -77,6 +87,7 @@ dependencies:
|
|
77
87
|
type: :development
|
78
88
|
prerelease: false
|
79
89
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
80
91
|
requirements:
|
81
92
|
- - ! '>='
|
82
93
|
- !ruby/object:Gem::Version
|
@@ -84,6 +95,7 @@ dependencies:
|
|
84
95
|
- !ruby/object:Gem::Dependency
|
85
96
|
name: rspec-rails
|
86
97
|
requirement: !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
87
99
|
requirements:
|
88
100
|
- - ~>
|
89
101
|
- !ruby/object:Gem::Version
|
@@ -91,6 +103,7 @@ dependencies:
|
|
91
103
|
type: :development
|
92
104
|
prerelease: false
|
93
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
94
107
|
requirements:
|
95
108
|
- - ~>
|
96
109
|
- !ruby/object:Gem::Version
|
@@ -111,6 +124,7 @@ files:
|
|
111
124
|
- README.md
|
112
125
|
- Rakefile
|
113
126
|
- config.ru
|
127
|
+
- config/locales/en.yml
|
114
128
|
- lib/rapporteur/load_check.rb
|
115
129
|
- rapporteur-load_check.gemspec
|
116
130
|
- spec/internal/config/database.yml
|
@@ -124,26 +138,33 @@ files:
|
|
124
138
|
homepage: ''
|
125
139
|
licenses:
|
126
140
|
- MIT
|
127
|
-
metadata: {}
|
128
141
|
post_install_message:
|
129
142
|
rdoc_options: []
|
130
143
|
require_paths:
|
131
144
|
- lib
|
132
145
|
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
133
147
|
requirements:
|
134
148
|
- - ! '>='
|
135
149
|
- !ruby/object:Gem::Version
|
136
150
|
version: '0'
|
151
|
+
segments:
|
152
|
+
- 0
|
153
|
+
hash: 1685104190720083401
|
137
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
138
156
|
requirements:
|
139
157
|
- - ! '>='
|
140
158
|
- !ruby/object:Gem::Version
|
141
159
|
version: '0'
|
160
|
+
segments:
|
161
|
+
- 0
|
162
|
+
hash: 1685104190720083401
|
142
163
|
requirements: []
|
143
164
|
rubyforge_project:
|
144
|
-
rubygems_version:
|
165
|
+
rubygems_version: 1.8.25
|
145
166
|
signing_key:
|
146
|
-
specification_version:
|
167
|
+
specification_version: 3
|
147
168
|
summary: Machine load reporting for rapporteur
|
148
169
|
test_files:
|
149
170
|
- spec/internal/config/database.yml
|
checksums.yaml
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
---
|
2
|
-
!binary "U0hBMQ==":
|
3
|
-
metadata.gz: !binary |-
|
4
|
-
YzU5ZjlhOWU0ZjllNDdjNDg3ZmYwOTExOWU1ZDY1ZjdmOGI2OTBmNg==
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MmViZjNlZmJiM2JhZGQyOGQ3YjQxZjk5MGE5ZDU4ZDcxMGFlODZjZA==
|
7
|
-
!binary "U0hBNTEy":
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
OTEwNDNiYmVkMzYyMTM1ZGZmZDQ0NzQ0NzE5ZWYxNWU5ZWU5YzIxMjFhYjQ1
|
10
|
-
MmMxNTM5YzdlNGRkNjI3MzBjYjE4ZmEyZWM1ZGQ4ZGY1ZGEyM2ZhOTUzMGUx
|
11
|
-
MWVmMWZiNDI5MDcyNzVjZjY5NDUwMjFhZWE0N2Y3YTkwY2Y1NjM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NzVhYWVhYjc0Y2Y0M2YzODQ0NjQyMjYxZjdiNmY0ZWJkNmNhNjFkNzBiN2Ux
|
14
|
-
YjIzYzU4OWQxYTg1ZTRkY2RmODQ3NjFlODUxYTUwZTdmYjZkNmMwZjIxYzRm
|
15
|
-
Yjc0MTJhODhlYTFhZmFhNjkzZTVkOWFlMTNmODEyNTAyMmY2Mzc=
|