rapporteur-load_check 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDYwMTM0OTM0YmI1ZWE4NTI0YmQzMWE0NDA1NjVjMDY1ODBlOTA4MQ==
4
+ YzU5ZjlhOWU0ZjllNDdjNDg3ZmYwOTExOWU1ZDY1ZjdmOGI2OTBmNg==
5
5
  data.tar.gz: !binary |-
6
- OTQ3MmI4MTIwMTBjN2MwNDJmOWVjNWExYTg3OGJmOGMzNWE3OGY0OA==
6
+ MmViZjNlZmJiM2JhZGQyOGQ3YjQxZjk5MGE5ZDU4ZDcxMGFlODZjZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MjcwMjVhOThlY2UyN2E3MGJkZGQxOTE5NTYwMzdiNWJiNjEyMmM3M2FhYWVj
10
- MjIwMmUwZmFmNjU0ZmVhMDZlNjZkZThmNGUwNzQ1OWNlZTM0YmQ3NjY0NWYx
11
- OGU4NmY0MzE4NmIzYmZlYzY2YzA2YmJmNjc5NzY5ODFkMTI4ODM=
9
+ OTEwNDNiYmVkMzYyMTM1ZGZmZDQ0NzQ0NzE5ZWYxNWU5ZWU5YzIxMjFhYjQ1
10
+ MmMxNTM5YzdlNGRkNjI3MzBjYjE4ZmEyZWM1ZGQ4ZGY1ZGEyM2ZhOTUzMGUx
11
+ MWVmMWZiNDI5MDcyNzVjZjY5NDUwMjFhZWE0N2Y3YTkwY2Y1NjM=
12
12
  data.tar.gz: !binary |-
13
- MzkwYWRjNzc4NzMwNjcxZWFjOGExNmY0ZTgzZDZiODhmY2Y0MjYxNjVmMTk0
14
- NDFjN2I2NGJhOWVmMjgwZTc2NjU3ZDk3NTk2ZDljZGZiYTdkMzUyNDNkNDI3
15
- MDA1MjFiYzZjNzE1MTZlOTAzMjhjN2NhODc5NTQ5ZDgxOWMxYjg=
13
+ NzVhYWVhYjc0Y2Y0M2YzODQ0NjQyMjYxZjdiNmY0ZWJkNmNhNjFkNzBiN2Ux
14
+ YjIzYzU4OWQxYTg1ZTRkY2RmODQ3NjFlODUxYTUwZTdmYjZkNmMwZjIxYzRm
15
+ Yjc0MTJhODhlYTFhZmFhNjkzZTVkOWFlMTNmODEyNTAyMmY2Mzc=
data/CHANGELOG.md CHANGED
@@ -4,8 +4,13 @@
4
4
 
5
5
  * No significant changes.
6
6
 
7
+ ## [1.1.0][v1.1.0] / 2013-05-30
8
+
9
+ * Allow adjustment of load failure threshold.
10
+
7
11
  ## 1.0.0 / 2013-05-30
8
12
 
9
13
  * Initial public release.
10
14
 
11
- [unreleased]: https://github.com/codeschool/rapporteur-load_check/compare/1.0.0...master
15
+ [unreleased]: https://github.com/codeschool/rapporteur-load_check/compare/v1.1.0...master
16
+ [v1.1.0]: https://github.com/codeschool/rapporteur-load_check/compare/v1.0.0...v1.1.0
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Dray Lacy
1
+ Copyright (c) 2013 Envy Labs LLC and Code School LLC
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -26,6 +26,15 @@ application configuration files or initializers, such as:
26
26
  Rapporteur::Checker.add_check(Rapporteur::Checks::LoadCheck)
27
27
  ```
28
28
 
29
+ By default, a load value of 8 or greater triggers a failure. You can adjust
30
+ this value by passing the threshold to LoadCheck.new, like so:
31
+
32
+ ```ruby
33
+ Rapporteur::Checker.add_check(Rapporteur::Checks::LoadCheck.new(4))
34
+ ```
35
+
36
+ The above would cause the checker to fail if load goes above 4.0.
37
+
29
38
  ## Contributing
30
39
 
31
40
  1. Fork it
@@ -13,12 +13,22 @@ module Rapporteur
13
13
 
14
14
  private_class_method :getloadavg, :strerror
15
15
 
16
- def self.call(checker)
17
- loadavg = current_load
18
- checker.add_error(:excess_load) if loadavg > 8.0
16
+ DEFAULT_TOLERANCE = 8.0
17
+
18
+ def initialize(tolerance=DEFAULT_TOLERANCE)
19
+ @tolerance = tolerance
20
+ end
21
+
22
+ def call(checker)
23
+ loadavg = self.class.current_load
24
+ checker.add_error(:excess_load) if loadavg > @tolerance
19
25
  checker.add_message(:load, loadavg)
20
26
  end
21
27
 
28
+ def self.call(checker)
29
+ new.call(checker)
30
+ end
31
+
22
32
  def self.current_load
23
33
  loadavg = FFI::MemoryPointer.new(:double, 1)
24
34
  if getloadavg(loadavg, 1) == -1
@@ -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 = "1.0.0"
7
+ spec.version = "1.1.0"
8
8
  spec.authors = ["Envy Labs", "Code School"]
9
9
  spec.email = [""]
10
10
  spec.description = %q{Machine load reporting for rapporteur}
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: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Envy Labs