simple_monitor 0.0.2 → 0.0.3
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.
- data/README.md +4 -2
- data/lib/simple_monitor/version.rb +1 -1
- data/lib/simple_monitor.rb +2 -0
- data/spec/simple_monitor_spec.rb +13 -1
- metadata +5 -5
data/README.md
CHANGED
@@ -35,13 +35,15 @@ require "simple_monitor"
|
|
35
35
|
class HighJobMonitor
|
36
36
|
include SimpleMonitor
|
37
37
|
|
38
|
+
# This is the most important method you should override
|
39
|
+
# It returns true/false to determine if there's an alert
|
38
40
|
def needs_alert?
|
39
41
|
Queue.jobs.count > options[:job_count_threshold]
|
40
42
|
end
|
41
43
|
|
44
|
+
# Alert sending implementation of your choice. SimpleMonitor
|
45
|
+
# leaves this up to you
|
42
46
|
def send_alert
|
43
|
-
# Alert sending method of your choice. SimpleMonitor
|
44
|
-
# leaves this up to you
|
45
47
|
Mailer.deliver_high_job_alert(Queue.jobs.count)
|
46
48
|
end
|
47
49
|
end
|
data/lib/simple_monitor.rb
CHANGED
data/spec/simple_monitor_spec.rb
CHANGED
@@ -21,7 +21,7 @@ describe SimpleMonitor do
|
|
21
21
|
monitor.options[:foo].should == :bar
|
22
22
|
end
|
23
23
|
|
24
|
-
it "
|
24
|
+
it "extracts :only_explicit_logging from the passed options" do
|
25
25
|
TestMonitor.new.only_explicit_logging.should be_nil
|
26
26
|
TestMonitor.new(:only_explicit_logging => true).only_explicit_logging.should be_true
|
27
27
|
end
|
@@ -48,6 +48,18 @@ describe SimpleMonitor, "logger" do
|
|
48
48
|
Object.send(:remove_const, :Rails)
|
49
49
|
end
|
50
50
|
|
51
|
+
it "is defaulted to the Padrino.logger if present" do
|
52
|
+
module Padrino
|
53
|
+
def self.logger
|
54
|
+
:padrino_logger
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
subject.logger.should == :padrino_logger
|
59
|
+
|
60
|
+
Object.send(:remove_const, :Padrino)
|
61
|
+
end
|
62
|
+
|
51
63
|
it "sends info, warn, error, and debug methods to it prefixed by the class name" do
|
52
64
|
stub_logger = stub('logger')
|
53
65
|
subject.logger = stub_logger
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ default_executable:
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|
17
|
-
requirement: &
|
17
|
+
requirement: &2161263720 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :development
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2161263720
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: rspec
|
28
|
-
requirement: &
|
28
|
+
requirement: &2161263300 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,7 +33,7 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2161263300
|
37
37
|
description: ''
|
38
38
|
email:
|
39
39
|
- xternal1+github@gmail.com
|