rails_riemann_middleware 0.5.1 → 0.6.0
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/lib/rails_riemann_middleware/event.rb +1 -1
- data/lib/rails_riemann_middleware/exception_notification.rb +4 -0
- data/lib/rails_riemann_middleware/version.rb +1 -1
- data/lib/rails_riemann_middleware.rb +10 -0
- data/rails_riemann_middleware.gemspec +1 -0
- data/specs/{duraction_spec.rb → duration_spec.rb} +0 -0
- data/specs/exception_notification_spec.rb +23 -0
- data/specs/notifier_spec.rb +37 -0
- metadata +9 -6
@@ -25,6 +25,16 @@ module RailsRiemannMiddleware
|
|
25
25
|
Duration.new(event, env, start_time).send if send_durations
|
26
26
|
end
|
27
27
|
|
28
|
+
def self.exception_notification(env, exception)
|
29
|
+
event = Event.new
|
30
|
+
ExceptionNotification.new(event, env, exception)
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.background_exception_notification(exception)
|
34
|
+
event = Event.new
|
35
|
+
env = {}
|
36
|
+
ExceptionNotification.new(event, env, exception)
|
37
|
+
end
|
28
38
|
end
|
29
39
|
|
30
40
|
end
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
require 'rails_riemann_middleware/exception_notification'
|
3
|
+
|
4
|
+
module RailsRiemannMiddleware
|
5
|
+
describe ExceptionNotification do
|
6
|
+
let(:event) {MiniTest::Mock.new}
|
7
|
+
let(:env) { {'HTTP_HOST' => 'some_host'}}
|
8
|
+
let(:exception) {Object.new}
|
9
|
+
|
10
|
+
subject {ExceptionNotification.new(event, env, exception)}
|
11
|
+
|
12
|
+
describe '#deliver' do
|
13
|
+
it "adds its message to its event" do
|
14
|
+
message = Object.new
|
15
|
+
event.expect(:<<, Object.new, [message])
|
16
|
+
subject.stub(:message, message) do
|
17
|
+
subject.deliver
|
18
|
+
end
|
19
|
+
event.verify
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
require 'rails_riemann_middleware'
|
3
|
+
|
4
|
+
module RailsRiemannMiddleware
|
5
|
+
describe Notifier do
|
6
|
+
let(:exception_notification_new) { MiniTest::Mock.new }
|
7
|
+
let(:error) { Object.new }
|
8
|
+
|
9
|
+
# Support ExceptionNotification gem API
|
10
|
+
describe '#exception_notification' do
|
11
|
+
it "creates an ExceptionNotification with an event" do
|
12
|
+
env = Object.new
|
13
|
+
exception_notification_new.expect(:call, nil) do |a1, a2, a3|
|
14
|
+
a1.kind_of?(Event) && a2 == env && a3 == error
|
15
|
+
end
|
16
|
+
|
17
|
+
ExceptionNotification.stub(:new, exception_notification_new) do
|
18
|
+
Notifier.exception_notification(env, error)
|
19
|
+
end
|
20
|
+
exception_notification_new.verify
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#background_exception_notification" do
|
25
|
+
it "creates an ExceptionNotification with event and empty env" do
|
26
|
+
exception_notification_new.expect(:call, nil) do |a1, a2, a3|
|
27
|
+
a1.kind_of?(Event) && a2 == {} && a3 == error
|
28
|
+
end
|
29
|
+
|
30
|
+
ExceptionNotification.stub(:new, exception_notification_new) do
|
31
|
+
Notifier.background_exception_notification(error)
|
32
|
+
end
|
33
|
+
exception_notification_new.verify
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_riemann_middleware
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: riemann-client
|
16
|
-
requirement: &
|
16
|
+
requirement: &70117650213820 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 0.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70117650213820
|
25
25
|
description: Rack middleware for sending data to riemann
|
26
26
|
email:
|
27
27
|
- outtenr@gmail.com
|
@@ -41,10 +41,13 @@ files:
|
|
41
41
|
- lib/rails_riemann_middleware/headers.rb
|
42
42
|
- lib/rails_riemann_middleware/version.rb
|
43
43
|
- rails_riemann_middleware.gemspec
|
44
|
-
- specs/
|
44
|
+
- specs/duration_spec.rb
|
45
|
+
- specs/exception_notification_spec.rb
|
46
|
+
- specs/notifier_spec.rb
|
45
47
|
- specs/spec_helper.rb
|
46
48
|
homepage: ''
|
47
|
-
licenses:
|
49
|
+
licenses:
|
50
|
+
- MIT
|
48
51
|
post_install_message:
|
49
52
|
rdoc_options: []
|
50
53
|
require_paths:
|