roqua-support 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/lib/roqua-support/version.rb +1 -1
- data/lib/roqua/support/errors.rb +51 -0
- data/spec/roqua/support/errors_spec.rb +48 -0
- metadata +24 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d537f6968d87c89a2c76d6eaa69317470f29207
|
4
|
+
data.tar.gz: b10fe72f54f88222284c8af7b0a93327c9cac436
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9681dd8f6c01c76aa9e2fd210dc98ea4428239e68110d07c735621384a0dba4b85ad316b849bb563afb88391968d7de6998b8ef3b084d88873afc8dcf847fcf
|
7
|
+
data.tar.gz: eb6966c9414ccfd46d49bfe664396009779213131e0c706cd664a4a148e50bf4346f8e3d8fc1a453596751c1075ad0af00a0aebbcfccfdb3e56c78741b4b386c
|
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
module Roqua
|
2
|
+
module Support
|
3
|
+
module Errors
|
4
|
+
if const_defined?(:Appsignal)
|
5
|
+
module Appsignal
|
6
|
+
# TODO: If and when https://github.com/appsignal/appsignal/pull/9 is merged,
|
7
|
+
# this functionality should be supported directly by Appsignal.send_exception.
|
8
|
+
def send_exception_with_tags(exception, tags = {})
|
9
|
+
return if is_ignored_exception?(exception)
|
10
|
+
transaction = Appsignal::Transaction.create(SecureRandom.uuid, ENV.to_hash)
|
11
|
+
transaction.set_tags(tags)
|
12
|
+
transaction.add_exception(exception)
|
13
|
+
transaction.complete!
|
14
|
+
Appsignal.agent.send_queue
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.extra_parameters
|
20
|
+
@extra_parameters || {}
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.extra_parameters=(hash)
|
24
|
+
@extra_parameters = hash
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.report(exception, extra_params = {})
|
28
|
+
parameters = extra_parameters.merge(extra_params)
|
29
|
+
|
30
|
+
# Notify Roqua logging
|
31
|
+
if Roqua.respond_to?(:logger)
|
32
|
+
Roqua.logger.error('roqua.exception',
|
33
|
+
class_name: exception.class.to_s,
|
34
|
+
message: exception.message,
|
35
|
+
backtrace: exception.backtrace,
|
36
|
+
parameters: parameters)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Notify Airbrake
|
40
|
+
if const_defined?(:Airbrake)
|
41
|
+
Airbrake.notify_or_ignore(exception, parameters: parameters)
|
42
|
+
end
|
43
|
+
|
44
|
+
# Notify AppSignal
|
45
|
+
if const_defined?(:Appsignal)
|
46
|
+
Appsignal.send_exception_with_tags(exception, parameters: parameters)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'roqua/support/errors'
|
2
|
+
|
3
|
+
describe 'Error reporting' do
|
4
|
+
let(:exception) do
|
5
|
+
Exception.new('exception_message').tap do |exception|
|
6
|
+
exception.set_backtrace ['back', 'trace', 'lines']
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:logstream) { StringIO.new }
|
11
|
+
let(:logger) { Logger.new(logstream) }
|
12
|
+
let(:logwrapper) { Roqua::LogWrapper.new(logger) }
|
13
|
+
|
14
|
+
before do
|
15
|
+
Roqua.logger = logwrapper
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'sends notifications to the eventlog' do
|
19
|
+
Roqua.logger.should_receive(:error).with('roqua.exception',
|
20
|
+
class_name: 'Exception',
|
21
|
+
message: 'exception_message',
|
22
|
+
backtrace: ['back', 'trace', 'lines'],
|
23
|
+
parameters: {})
|
24
|
+
Roqua::Support::Errors.report exception
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'sends notifications to airbrake' do
|
28
|
+
stub_const("Airbrake", double("Airbrake"))
|
29
|
+
Airbrake.should_receive(:notify_or_ignore).with(exception, parameters: {})
|
30
|
+
Roqua::Support::Errors.report exception
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'sends notifications to appsignal' do
|
34
|
+
stub_const("Appsignal", double("Appsignal"))
|
35
|
+
Appsignal.should_receive(:send_exception_with_tags).with(exception, parameters: {})
|
36
|
+
Roqua::Support::Errors.report exception
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'supports default extra params' do
|
40
|
+
Roqua::Support::Errors.extra_parameters = {organization: 'some_org'}
|
41
|
+
Roqua.logger.should_receive(:error).with('roqua.exception',
|
42
|
+
class_name: 'Exception',
|
43
|
+
message: 'exception_message',
|
44
|
+
backtrace: ['back', 'trace', 'lines'],
|
45
|
+
parameters: {organization: 'some_org'})
|
46
|
+
Roqua::Support::Errors.report exception
|
47
|
+
end
|
48
|
+
end
|
metadata
CHANGED
@@ -1,81 +1,81 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roqua-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marten Veldthuis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.2'
|
20
|
-
- - <
|
20
|
+
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '5.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '3.2'
|
30
|
-
- - <
|
30
|
+
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '5.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: bundler
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ~>
|
37
|
+
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '1.0'
|
40
40
|
type: :development
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - ~>
|
44
|
+
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '1.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rake
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- -
|
51
|
+
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
53
|
version: '0'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- -
|
58
|
+
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: rspec
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- -
|
65
|
+
- - ">="
|
66
66
|
- !ruby/object:Gem::Version
|
67
67
|
version: 2.12.0
|
68
|
-
- - <
|
68
|
+
- - "<"
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '4.0'
|
71
71
|
type: :development
|
72
72
|
prerelease: false
|
73
73
|
version_requirements: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: 2.12.0
|
78
|
-
- - <
|
78
|
+
- - "<"
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '4.0'
|
81
81
|
description: 'Logging backend, freedom patches, '
|
@@ -84,9 +84,10 @@ executables: []
|
|
84
84
|
extensions: []
|
85
85
|
extra_rdoc_files: []
|
86
86
|
files:
|
87
|
-
- .gitignore
|
88
|
-
- .rspec
|
89
|
-
- .travis.yml
|
87
|
+
- ".gitignore"
|
88
|
+
- ".rspec"
|
89
|
+
- ".travis.yml"
|
90
|
+
- CHANGELOG.md
|
90
91
|
- Gemfile
|
91
92
|
- Gemfile.lock
|
92
93
|
- LICENSE.txt
|
@@ -100,6 +101,7 @@ files:
|
|
100
101
|
- lib/roqua/core_ext/fixnum/clamp.rb
|
101
102
|
- lib/roqua/support.rb
|
102
103
|
- lib/roqua/support/command_runner.rb
|
104
|
+
- lib/roqua/support/errors.rb
|
103
105
|
- lib/roqua/support/log_wrapper.rb
|
104
106
|
- lib/roqua/support/logging.rb
|
105
107
|
- lib/roqua/support/request_logger.rb
|
@@ -108,6 +110,7 @@ files:
|
|
108
110
|
- spec/roqua/core_ext/enumerable/sort_by_alphanum_spec.rb
|
109
111
|
- spec/roqua/core_ext/fabrication/singleton_spec.rb
|
110
112
|
- spec/roqua/core_ext/fixnum/clamp_spec.rb
|
113
|
+
- spec/roqua/support/errors_spec.rb
|
111
114
|
- spec/roqua/support/logging_spec.rb
|
112
115
|
- spec/roqua/support/request_logger_spec.rb
|
113
116
|
- spec/roqua/support_spec.rb
|
@@ -121,17 +124,17 @@ require_paths:
|
|
121
124
|
- lib
|
122
125
|
required_ruby_version: !ruby/object:Gem::Requirement
|
123
126
|
requirements:
|
124
|
-
- -
|
127
|
+
- - ">="
|
125
128
|
- !ruby/object:Gem::Version
|
126
129
|
version: '0'
|
127
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
131
|
requirements:
|
129
|
-
- -
|
132
|
+
- - ">="
|
130
133
|
- !ruby/object:Gem::Version
|
131
134
|
version: '0'
|
132
135
|
requirements: []
|
133
136
|
rubyforge_project:
|
134
|
-
rubygems_version: 2.1
|
137
|
+
rubygems_version: 2.2.1
|
135
138
|
signing_key:
|
136
139
|
specification_version: 4
|
137
140
|
summary: Helper objects and proxies used by a lot of RoQua applications
|
@@ -140,6 +143,7 @@ test_files:
|
|
140
143
|
- spec/roqua/core_ext/enumerable/sort_by_alphanum_spec.rb
|
141
144
|
- spec/roqua/core_ext/fabrication/singleton_spec.rb
|
142
145
|
- spec/roqua/core_ext/fixnum/clamp_spec.rb
|
146
|
+
- spec/roqua/support/errors_spec.rb
|
143
147
|
- spec/roqua/support/logging_spec.rb
|
144
148
|
- spec/roqua/support/request_logger_spec.rb
|
145
149
|
- spec/roqua/support_spec.rb
|