rapporteur-load_check 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.travis.yml +6 -1
- data/CHANGELOG.md +7 -1
- data/README.md +49 -0
- data/lib/rapporteur/load_check.rb +1 -1
- data/rapporteur-load_check.gemspec +1 -1
- data/spec/requests/load_check_spec.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
Mjk2NjVkZjJiYmFjNjY1ODQ0YzY4NTcyMWUyZWFiODJhOTRlNTJlY2YxM2Jl
|
10
|
-
NjI5OTM3MDVmNThiMGExZTNhZGRjMjFmMzBjMDU3MWY2NGQxMWFjZDI0MGMy
|
11
|
-
NjA0OWI3MDAyMGMyZjdjNDJhZTYwOGM4MmViMDg1MjU4YTNmMDI=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ODMxOTUyYzEzM2Y0N2I4MGVkMjUyN2MwYzk3N2I4MjhhODYxZjgwYzFlYmY5
|
14
|
-
NjAxZjkwNmFjY2Y3ZGIxODNkMjNjMmYzODZjZDdhZjI1YzBjNzNmOWE4Zjdj
|
15
|
-
MWVjZThlN2QxNDQ5OTM1NTRmYTYwZDVkMTQ4ZDcyNDEyYzk3OTc=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4ed5c1ca52edd853103449294e69ce426b273d37
|
4
|
+
data.tar.gz: 1ba801d57dfe370ed2ad36bdbf92d7172cee797f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fe0a641129c25d422a39da73d784f470a538f8292f4011ff4c8252b4b0ea3d7cd06e8834544bae54dc39f4ecc814ce0f509e15b38b5f9835554e52fa2e5fcf03
|
7
|
+
data.tar.gz: d055397f48a5a38bb391ae465f5300d5e2fea0372ec0bdc084821e30ce13e91845300c15971ce6dd891c871478d69886323600ba9bd0298403344ed2e27ef19d
|
data/.travis.yml
CHANGED
@@ -1,11 +1,16 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 1.
|
3
|
+
- 1.8.7
|
4
4
|
- 1.9.3
|
5
|
+
- 2.0.0
|
5
6
|
- jruby
|
6
7
|
gemfile:
|
7
8
|
- gemfiles/rapporteur2.gemfile
|
8
9
|
- gemfiles/rapporteur3.gemfile
|
10
|
+
matrix:
|
11
|
+
exclude:
|
12
|
+
- rvm: 1.8.7
|
13
|
+
gemfile: gemfiles/rapporteur2.gemfile
|
9
14
|
notifications:
|
10
15
|
email: false
|
11
16
|
campfire:
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,11 @@
|
|
4
4
|
|
5
5
|
* No significant changes.
|
6
6
|
|
7
|
+
## [2.1.1][v2.1.1] / 2013-08-25
|
8
|
+
|
9
|
+
* Add explicit test and support for Ruby 2.0.
|
10
|
+
* Add Ruby 1.8 support (with Rapporteur 3+ and syntax fixes).
|
11
|
+
|
7
12
|
## [2.1.0][v2.1.0] / 2013-08-23
|
8
13
|
|
9
14
|
* Test and allow for Rapporteur 2.x and 3.x support.
|
@@ -27,7 +32,8 @@
|
|
27
32
|
|
28
33
|
* Initial public release.
|
29
34
|
|
30
|
-
[unreleased]: https://github.com/codeschool/rapporteur-load_check/compare/v2.1.
|
35
|
+
[unreleased]: https://github.com/codeschool/rapporteur-load_check/compare/v2.1.1...master
|
36
|
+
[v2.1.1]: https://github.com/codeschool/rapporteur-load_check/compare/v2.1.0...v2.1.1
|
31
37
|
[v2.1.0]: https://github.com/codeschool/rapporteur-load_check/compare/v2.0.0...v2.1.0
|
32
38
|
[v2.0.0]: https://github.com/codeschool/rapporteur-load_check/compare/v1.1.0...v2.0.0
|
33
39
|
[v1.1.0]: https://github.com/codeschool/rapporteur-load_check/compare/v1.0.0...v1.1.0
|
data/README.md
CHANGED
@@ -26,6 +26,15 @@ Or install it yourself as:
|
|
26
26
|
$ gem install rapporteur-load_check
|
27
27
|
```
|
28
28
|
|
29
|
+
### Supported environments
|
30
|
+
|
31
|
+
Supported Ruby versions:
|
32
|
+
|
33
|
+
* MRI 2.0.0
|
34
|
+
* MRI 1.9.3
|
35
|
+
* MRI 1.9.2
|
36
|
+
* MRI 1.8.7
|
37
|
+
|
29
38
|
## Usage
|
30
39
|
|
31
40
|
To add the check to your application, define the check in your environment or
|
@@ -36,6 +45,28 @@ application configuration files or initializers, such as:
|
|
36
45
|
Rapporteur.add_check(Rapporteur::Checks::LoadCheck)
|
37
46
|
```
|
38
47
|
|
48
|
+
And, if your server load is currently below the configured threshold, 0.54 for
|
49
|
+
this example, this library will add a `load` key and value to the success
|
50
|
+
response of Rapporteur (an HTTP 200 response):
|
51
|
+
|
52
|
+
```json
|
53
|
+
{
|
54
|
+
"load": 0.54
|
55
|
+
}
|
56
|
+
```
|
57
|
+
|
58
|
+
If, however, your server load is too high - let's say 12.32 - then this library
|
59
|
+
will fail, cause Rapporteur to give a non-success response, and add a `load`
|
60
|
+
key and message to the error output of the Rapporteur (an HTTP 500 response):
|
61
|
+
|
62
|
+
```json
|
63
|
+
{
|
64
|
+
"load": "above allowed threshold (12.32 > 8)"
|
65
|
+
}
|
66
|
+
```
|
67
|
+
|
68
|
+
### Configuration
|
69
|
+
|
39
70
|
By default, a load value of 8 or greater triggers a failure. You can adjust
|
40
71
|
this value by passing the threshold to LoadCheck.new, like so:
|
41
72
|
|
@@ -45,6 +76,24 @@ Rapporteur.add_check(Rapporteur::Checks::LoadCheck.new(4))
|
|
45
76
|
|
46
77
|
The above would cause the checker to fail if load goes above 4.0.
|
47
78
|
|
79
|
+
### Localization
|
80
|
+
|
81
|
+
If you would like to localize the failure response, you may do so by adding a
|
82
|
+
`rapporteur.errors.load.excessive` definition to your local I18n locales. This
|
83
|
+
library will provide the `value` (current load value) and `tolerance`
|
84
|
+
(configured threshold) in case you would like to include those values in your
|
85
|
+
message.
|
86
|
+
|
87
|
+
For example:
|
88
|
+
|
89
|
+
```yaml
|
90
|
+
fr:
|
91
|
+
rapporteur:
|
92
|
+
errors:
|
93
|
+
load:
|
94
|
+
excessive: "est trop élevé (%{value})"
|
95
|
+
```
|
96
|
+
|
48
97
|
## Contributing
|
49
98
|
|
50
99
|
1. Fork it
|
@@ -25,7 +25,7 @@ module Rapporteur
|
|
25
25
|
loadavg = self.class.current_load
|
26
26
|
|
27
27
|
if loadavg > @tolerance
|
28
|
-
checker.add_error(:load, :excessive, tolerance
|
28
|
+
checker.add_error(:load, :excessive, :tolerance => @tolerance, :value => loadavg)
|
29
29
|
checker.halt!
|
30
30
|
else
|
31
31
|
checker.add_message(:load, loadavg)
|
@@ -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 = "2.1.
|
7
|
+
spec.version = "2.1.1"
|
8
8
|
spec.authors = ["Envy Labs", "Code School"]
|
9
9
|
spec.email = [""]
|
10
10
|
spec.description = %q{Machine load reporting for rapporteur}
|
@@ -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(:load, I18n.t('rapporteur.errors.load.excessive', value
|
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
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapporteur-load_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Envy Labs
|
@@ -9,46 +9,46 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- -
|
25
|
+
- - '>='
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rapporteur
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '2.0'
|
35
35
|
- - <
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '4.0'
|
38
|
-
- -
|
38
|
+
- - '!='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 3.0.0
|
41
41
|
type: :runtime
|
42
42
|
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '2.0'
|
48
48
|
- - <
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '4.0'
|
51
|
-
- -
|
51
|
+
- - '!='
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: 3.0.0
|
54
54
|
- !ruby/object:Gem::Dependency
|
@@ -97,14 +97,14 @@ dependencies:
|
|
97
97
|
name: rake
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- -
|
100
|
+
- - '>='
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
type: :development
|
104
104
|
prerelease: false
|
105
105
|
version_requirements: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - '>='
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
- !ruby/object:Gem::Dependency
|
@@ -161,17 +161,17 @@ require_paths:
|
|
161
161
|
- lib
|
162
162
|
required_ruby_version: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - '>='
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
|
-
- -
|
169
|
+
- - '>='
|
170
170
|
- !ruby/object:Gem::Version
|
171
171
|
version: '0'
|
172
172
|
requirements: []
|
173
173
|
rubyforge_project:
|
174
|
-
rubygems_version: 2.0.
|
174
|
+
rubygems_version: 2.0.6
|
175
175
|
signing_key:
|
176
176
|
specification_version: 4
|
177
177
|
summary: Machine load reporting for rapporteur
|