exception_handling 2.17.0.pre.tstarck.1 → 3.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +0 -3
- data/.ruby-version +1 -1
- data/Gemfile +16 -12
- data/Gemfile.lock +138 -153
- data/README.md +21 -90
- data/Rakefile +11 -8
- data/exception_handling.gemspec +10 -14
- data/lib/exception_handling/exception_info.rb +11 -15
- data/lib/exception_handling/honeybadger_callbacks.rb +59 -0
- data/lib/exception_handling/log_stub_error.rb +1 -2
- data/lib/exception_handling/methods.rb +53 -6
- data/lib/exception_handling/testing.rb +10 -20
- data/lib/exception_handling/version.rb +1 -1
- data/lib/exception_handling.rb +34 -135
- data/semaphore_ci/setup.sh +3 -0
- data/{spec → test}/helpers/exception_helpers.rb +2 -2
- data/{spec/spec_helper.rb → test/test_helper.rb} +45 -75
- data/test/unit/exception_handling/exception_catalog_test.rb +85 -0
- data/test/unit/exception_handling/exception_description_test.rb +82 -0
- data/{spec/unit/exception_handling/exception_info_spec.rb → test/unit/exception_handling/exception_info_test.rb} +114 -170
- data/test/unit/exception_handling/honeybadger_callbacks_test.rb +122 -0
- data/{spec/unit/exception_handling/log_error_stub_spec.rb → test/unit/exception_handling/log_error_stub_test.rb} +22 -38
- data/{spec/unit/exception_handling/mailer_spec.rb → test/unit/exception_handling/mailer_test.rb} +18 -17
- data/test/unit/exception_handling/methods_test.rb +84 -0
- data/test/unit/exception_handling/sensu_test.rb +52 -0
- data/test/unit/exception_handling_test.rb +1109 -0
- metadata +59 -99
- data/.github/CODEOWNERS +0 -1
- data/.github/workflows/pipeline.yml +0 -36
- data/.rspec +0 -3
- data/.tool-versions +0 -1
- data/Appraisals +0 -19
- data/CHANGELOG.md +0 -149
- data/gemfiles/rails_5.gemfile +0 -18
- data/gemfiles/rails_6.gemfile +0 -18
- data/gemfiles/rails_7.gemfile +0 -18
- data/lib/exception_handling/escalate_callback.rb +0 -19
- data/lib/exception_handling/logging_methods.rb +0 -27
- data/spec/rake_test_warning_false.rb +0 -20
- data/spec/unit/exception_handling/escalate_callback_spec.rb +0 -81
- data/spec/unit/exception_handling/exception_catalog_spec.rb +0 -85
- data/spec/unit/exception_handling/exception_description_spec.rb +0 -82
- data/spec/unit/exception_handling/logging_methods_spec.rb +0 -38
- data/spec/unit/exception_handling/methods_spec.rb +0 -105
- data/spec/unit/exception_handling/sensu_spec.rb +0 -51
- data/spec/unit/exception_handling_spec.rb +0 -1465
- /data/{spec → test}/helpers/controller_helpers.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6aee76b81d1d4742150afdeb95f8a6f544671a3f
|
4
|
+
data.tar.gz: 4822461573c54709a2d977b82e47de35cecfa51e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de1c0ab7cb7e7a493ce5f8c8d155ad98450edc891636e2d8e9d82ec2d8bdc312b45ba96f5902e0bc2d70adb35c0e4e20317bbea7d72d54625d7c2764ac2fb374
|
7
|
+
data.tar.gz: 7546dd2be9a2701d360cdd5fee3ea0e93b9a26e0072c835940659d5244c0e625743924cdde737fee08a7d5f909d03df1752b8e9ae6b8a7d354b62a77d8b89a57
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.2
|
data/Gemfile
CHANGED
@@ -2,17 +2,21 @@
|
|
2
2
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
|
5
|
+
# Specify your gem's dependencies in attr_default.gemspec
|
5
6
|
gemspec
|
6
7
|
|
7
|
-
gem 'actionmailer',
|
8
|
-
gem 'actionpack',
|
9
|
-
gem 'activesupport', '
|
10
|
-
|
11
|
-
|
12
|
-
gem 'pry'
|
13
|
-
gem '
|
14
|
-
gem '
|
15
|
-
gem '
|
16
|
-
gem '
|
17
|
-
|
18
|
-
|
8
|
+
gem 'actionmailer', '>= 4.2.11.1'
|
9
|
+
gem 'actionpack', '>= 4.2.11.1'
|
10
|
+
gem 'activesupport', '>= 4.2.11.1'
|
11
|
+
|
12
|
+
group :development do
|
13
|
+
gem 'pry'
|
14
|
+
gem 'rake', '>=0.9'
|
15
|
+
gem 'rr'
|
16
|
+
gem 'rubocop'
|
17
|
+
gem 'shoulda', '> 3.1.1'
|
18
|
+
end
|
19
|
+
|
20
|
+
group :test do
|
21
|
+
gem 'honeybadger', '3.3.1-1', git: 'git@github.com:Invoca/honeybadger-ruby', ref: 'bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6'
|
22
|
+
end
|
data/Gemfile.lock
CHANGED
@@ -1,182 +1,167 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git@github.com:Invoca/honeybadger-ruby
|
3
|
+
revision: bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6
|
4
|
+
ref: bb5f2b8a86e4147c38a6270d39ad610fab4dd5e6
|
5
|
+
specs:
|
6
|
+
honeybadger (3.3.1.pre.1)
|
7
|
+
|
1
8
|
PATH
|
2
9
|
remote: .
|
3
10
|
specs:
|
4
|
-
exception_handling (
|
5
|
-
actionmailer (
|
6
|
-
actionpack (
|
7
|
-
activesupport (
|
8
|
-
contextual_logger
|
9
|
-
escalate (~> 0.3)
|
11
|
+
exception_handling (3.0.pre.1)
|
12
|
+
actionmailer (~> 4.2)
|
13
|
+
actionpack (~> 4.2)
|
14
|
+
activesupport (~> 4.2)
|
15
|
+
contextual_logger
|
10
16
|
eventmachine (~> 1.0)
|
11
|
-
|
12
|
-
|
13
|
-
psych (~> 3.0)
|
17
|
+
hobo_support
|
18
|
+
invoca-utils (~> 0.0)
|
14
19
|
|
15
20
|
GEM
|
16
21
|
remote: https://rubygems.org/
|
17
22
|
specs:
|
18
|
-
actionmailer (
|
19
|
-
actionpack (=
|
20
|
-
actionview (=
|
21
|
-
activejob (=
|
22
|
-
activesupport (= 6.1.7.6)
|
23
|
+
actionmailer (4.2.11.1)
|
24
|
+
actionpack (= 4.2.11.1)
|
25
|
+
actionview (= 4.2.11.1)
|
26
|
+
activejob (= 4.2.11.1)
|
23
27
|
mail (~> 2.5, >= 2.5.4)
|
24
|
-
rails-dom-testing (~>
|
25
|
-
actionpack (
|
26
|
-
actionview (=
|
27
|
-
activesupport (=
|
28
|
-
rack (~>
|
29
|
-
rack-test (
|
30
|
-
rails-dom-testing (~>
|
31
|
-
rails-html-sanitizer (~> 1.0, >= 1.2
|
32
|
-
actionview (
|
33
|
-
activesupport (=
|
28
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
29
|
+
actionpack (4.2.11.1)
|
30
|
+
actionview (= 4.2.11.1)
|
31
|
+
activesupport (= 4.2.11.1)
|
32
|
+
rack (~> 1.6)
|
33
|
+
rack-test (~> 0.6.2)
|
34
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
35
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
36
|
+
actionview (4.2.11.1)
|
37
|
+
activesupport (= 4.2.11.1)
|
38
|
+
builder (~> 3.1)
|
39
|
+
erubis (~> 2.7.0)
|
40
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
41
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
42
|
+
activejob (4.2.11.1)
|
43
|
+
activesupport (= 4.2.11.1)
|
44
|
+
globalid (>= 0.3.0)
|
45
|
+
activemodel (4.2.11.1)
|
46
|
+
activesupport (= 4.2.11.1)
|
34
47
|
builder (~> 3.1)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
ast (2.4.2)
|
52
|
-
builder (3.2.4)
|
53
|
-
byebug (11.1.3)
|
54
|
-
coderay (1.1.3)
|
55
|
-
concurrent-ruby (1.2.3)
|
56
|
-
contextual_logger (1.3.0)
|
57
|
-
activesupport (< 7.1)
|
48
|
+
activerecord (4.2.11.1)
|
49
|
+
activemodel (= 4.2.11.1)
|
50
|
+
activesupport (= 4.2.11.1)
|
51
|
+
arel (~> 6.0)
|
52
|
+
activesupport (4.2.11.1)
|
53
|
+
i18n (~> 0.7)
|
54
|
+
minitest (~> 5.1)
|
55
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
56
|
+
tzinfo (~> 1.1)
|
57
|
+
arel (6.0.4)
|
58
|
+
ast (2.4.0)
|
59
|
+
builder (3.2.3)
|
60
|
+
coderay (1.1.2)
|
61
|
+
concurrent-ruby (1.1.5)
|
62
|
+
contextual_logger (0.3.1)
|
63
|
+
activesupport
|
58
64
|
json
|
59
|
-
crass (1.0.
|
60
|
-
|
61
|
-
diff-lcs (1.5.1)
|
62
|
-
erubi (1.12.0)
|
63
|
-
escalate (0.3.0)
|
65
|
+
crass (1.0.4)
|
66
|
+
erubis (2.7.0)
|
64
67
|
eventmachine (1.2.7)
|
65
|
-
globalid (
|
66
|
-
activesupport (>=
|
67
|
-
|
68
|
-
|
68
|
+
globalid (0.4.2)
|
69
|
+
activesupport (>= 4.2.0)
|
70
|
+
hobo_support (2.2.6)
|
71
|
+
rails (~> 4.2.6)
|
72
|
+
i18n (0.9.5)
|
69
73
|
concurrent-ruby (~> 1.0)
|
70
|
-
invoca-utils (0.5
|
71
|
-
|
72
|
-
json (2.
|
73
|
-
|
74
|
-
loofah (2.22.0)
|
74
|
+
invoca-utils (0.0.5)
|
75
|
+
jaro_winkler (1.5.3)
|
76
|
+
json (2.3.0)
|
77
|
+
loofah (2.2.3)
|
75
78
|
crass (~> 1.0.2)
|
76
|
-
nokogiri (>= 1.
|
77
|
-
mail (2.
|
79
|
+
nokogiri (>= 1.5.9)
|
80
|
+
mail (2.7.1)
|
78
81
|
mini_mime (>= 0.1.1)
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
activesupport (
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
regexp_parser (2.9.0)
|
124
|
-
rexml (3.2.6)
|
125
|
-
rspec (3.13.0)
|
126
|
-
rspec-core (~> 3.13.0)
|
127
|
-
rspec-expectations (~> 3.13.0)
|
128
|
-
rspec-mocks (~> 3.13.0)
|
129
|
-
rspec-core (3.13.0)
|
130
|
-
rspec-support (~> 3.13.0)
|
131
|
-
rspec-expectations (3.13.0)
|
132
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
133
|
-
rspec-support (~> 3.13.0)
|
134
|
-
rspec-mocks (3.13.0)
|
135
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
136
|
-
rspec-support (~> 3.13.0)
|
137
|
-
rspec-support (3.13.0)
|
138
|
-
rspec_junit_formatter (0.6.0)
|
139
|
-
rspec-core (>= 2, < 4, != 2.12.0)
|
140
|
-
rubocop (1.60.2)
|
141
|
-
json (~> 2.3)
|
142
|
-
language_server-protocol (>= 3.17.0)
|
82
|
+
method_source (0.9.2)
|
83
|
+
mini_mime (1.0.1)
|
84
|
+
mini_portile2 (2.4.0)
|
85
|
+
minitest (5.11.3)
|
86
|
+
nokogiri (1.10.4)
|
87
|
+
mini_portile2 (~> 2.4.0)
|
88
|
+
parallel (1.17.0)
|
89
|
+
parser (2.6.3.0)
|
90
|
+
ast (~> 2.4.0)
|
91
|
+
pry (0.12.2)
|
92
|
+
coderay (~> 1.1.0)
|
93
|
+
method_source (~> 0.9.0)
|
94
|
+
rack (1.6.11)
|
95
|
+
rack-test (0.6.3)
|
96
|
+
rack (>= 1.0)
|
97
|
+
rails (4.2.11.1)
|
98
|
+
actionmailer (= 4.2.11.1)
|
99
|
+
actionpack (= 4.2.11.1)
|
100
|
+
actionview (= 4.2.11.1)
|
101
|
+
activejob (= 4.2.11.1)
|
102
|
+
activemodel (= 4.2.11.1)
|
103
|
+
activerecord (= 4.2.11.1)
|
104
|
+
activesupport (= 4.2.11.1)
|
105
|
+
bundler (>= 1.3.0, < 2.0)
|
106
|
+
railties (= 4.2.11.1)
|
107
|
+
sprockets-rails
|
108
|
+
rails-deprecated_sanitizer (1.0.3)
|
109
|
+
activesupport (>= 4.2.0.alpha)
|
110
|
+
rails-dom-testing (1.0.9)
|
111
|
+
activesupport (>= 4.2.0, < 5.0)
|
112
|
+
nokogiri (~> 1.6)
|
113
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
114
|
+
rails-html-sanitizer (1.0.4)
|
115
|
+
loofah (~> 2.2, >= 2.2.2)
|
116
|
+
railties (4.2.11.1)
|
117
|
+
actionpack (= 4.2.11.1)
|
118
|
+
activesupport (= 4.2.11.1)
|
119
|
+
rake (>= 0.8.7)
|
120
|
+
thor (>= 0.18.1, < 2.0)
|
121
|
+
rainbow (3.0.0)
|
122
|
+
rake (12.3.2)
|
123
|
+
rr (1.2.1)
|
124
|
+
rubocop (0.74.0)
|
125
|
+
jaro_winkler (~> 1.5.1)
|
143
126
|
parallel (~> 1.10)
|
144
|
-
parser (>=
|
127
|
+
parser (>= 2.6)
|
145
128
|
rainbow (>= 2.2.2, < 4.0)
|
146
|
-
regexp_parser (>= 1.8, < 3.0)
|
147
|
-
rexml (>= 3.2.5, < 4.0)
|
148
|
-
rubocop-ast (>= 1.30.0, < 2.0)
|
149
129
|
ruby-progressbar (~> 1.7)
|
150
|
-
unicode-display_width (>=
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
130
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
131
|
+
ruby-progressbar (1.10.1)
|
132
|
+
shoulda (3.6.0)
|
133
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
134
|
+
shoulda-matchers (~> 3.0)
|
135
|
+
shoulda-context (1.2.2)
|
136
|
+
shoulda-matchers (3.1.3)
|
137
|
+
activesupport (>= 4.0.0)
|
138
|
+
sprockets (3.7.2)
|
159
139
|
concurrent-ruby (~> 1.0)
|
160
|
-
|
161
|
-
|
140
|
+
rack (> 1, < 3)
|
141
|
+
sprockets-rails (3.2.1)
|
142
|
+
actionpack (>= 4.0)
|
143
|
+
activesupport (>= 4.0)
|
144
|
+
sprockets (>= 3.0.0)
|
145
|
+
thor (1.0.1)
|
146
|
+
thread_safe (0.3.6)
|
147
|
+
tzinfo (1.2.5)
|
148
|
+
thread_safe (~> 0.1)
|
149
|
+
unicode-display_width (1.6.0)
|
162
150
|
|
163
151
|
PLATFORMS
|
164
152
|
ruby
|
165
153
|
|
166
154
|
DEPENDENCIES
|
167
|
-
actionmailer (
|
168
|
-
actionpack (
|
169
|
-
activesupport (
|
170
|
-
appraisal (~> 2.2)
|
155
|
+
actionmailer (>= 4.2.11.1)
|
156
|
+
actionpack (>= 4.2.11.1)
|
157
|
+
activesupport (>= 4.2.11.1)
|
171
158
|
exception_handling!
|
172
|
-
honeybadger (
|
159
|
+
honeybadger (= 3.3.1.pre.1)!
|
173
160
|
pry
|
174
|
-
|
175
|
-
|
176
|
-
rspec
|
177
|
-
rspec_junit_formatter
|
161
|
+
rake (>= 0.9)
|
162
|
+
rr
|
178
163
|
rubocop
|
179
|
-
|
164
|
+
shoulda (> 3.1.1)
|
180
165
|
|
181
166
|
BUNDLED WITH
|
182
|
-
|
167
|
+
1.17.2
|
data/README.md
CHANGED
@@ -2,10 +2,6 @@
|
|
2
2
|
|
3
3
|
Enable emails for your exceptions that occur in your application!
|
4
4
|
|
5
|
-
## Dependencies
|
6
|
-
- Ruby 2.6
|
7
|
-
- Rails >= 4.2, < 7
|
8
|
-
|
9
5
|
## Installation
|
10
6
|
|
11
7
|
Add this line to your application's Gemfile:
|
@@ -25,27 +21,24 @@ Or install it yourself as:
|
|
25
21
|
Add some code to initialize the settings in your application.
|
26
22
|
For example:
|
27
23
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
ExceptionHandling.
|
33
|
-
ExceptionHandling.
|
34
|
-
ExceptionHandling.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
ExceptionHandling.
|
39
|
-
ExceptionHandling.
|
40
|
-
ExceptionHandling.
|
41
|
-
ExceptionHandling.
|
42
|
-
ExceptionHandling.
|
43
|
-
ExceptionHandling.
|
44
|
-
ExceptionHandling.
|
45
|
-
|
46
|
-
ExceptionHandling.honeybadger_auto_tagger = ->(exception) { [] } # See "Automatically Tagging Exceptions" section below for examples
|
47
|
-
ExceptionHandling.add_honeybadger_tag_from_log_context("tag-name", path: ["path", "in", "log", "context"])
|
48
|
-
```
|
24
|
+
require "exception_handling"
|
25
|
+
|
26
|
+
# required
|
27
|
+
ExceptionHandling.server_name = Cluster['server_name']
|
28
|
+
ExceptionHandling.sender_address = %("Exceptions" <exceptions@example.com>)
|
29
|
+
ExceptionHandling.exception_recipients = ['exceptions@example.com']
|
30
|
+
ExceptionHandling.logger = Rails.logger
|
31
|
+
|
32
|
+
# optional
|
33
|
+
ExceptionHandling.escalation_recipients = ['escalation@example.com']
|
34
|
+
ExceptionHandling.filter_list_filename = "#{Rails.root}/config/exception_filters.yml"
|
35
|
+
ExceptionHandling.email_environment = Rails.env
|
36
|
+
ExceptionHandling.eventmachine_safe = false
|
37
|
+
ExceptionHandling.eventmachine_synchrony = false
|
38
|
+
ExceptionHandling.sensu_host = "127.0.0.1"
|
39
|
+
ExceptionHandling.sensu_port = 3030
|
40
|
+
ExceptionHandling.sensu_prefix = ""
|
41
|
+
|
49
42
|
|
50
43
|
## Usage
|
51
44
|
|
@@ -65,68 +58,6 @@ Then call any method available in the `ExceptionHandling::Methods` mixin:
|
|
65
58
|
flash.now['error'] = "A specific error occurred. Support has been notified."
|
66
59
|
end
|
67
60
|
|
68
|
-
### Tagging Exceptions in Honeybadger
|
69
|
-
|
70
|
-
⚠️ Honeybadger differentiates tags by spaces and/or commas, so you should **not** include spaces or commas in your tags.
|
71
|
-
|
72
|
-
⚠️ Tags are case-sensitive.
|
73
|
-
|
74
|
-
#### Manually Tagging Exceptions
|
75
|
-
|
76
|
-
Add `:honeybadger_tags` to your `log_context` usage with an array of strings.
|
77
|
-
|
78
|
-
```ruby
|
79
|
-
log_error(ex, "A specific error occurred.", honeybadger_tags: ["critical", "sequoia"])
|
80
|
-
```
|
81
|
-
|
82
|
-
**Note**: Manual tags will be merged with any automatic tags.
|
83
|
-
|
84
|
-
#### Automatically Tagging Exceptions via Proc (`honeybadger_auto_tagger=`)
|
85
|
-
|
86
|
-
Configure exception handling so that you can automatically apply multiple tags to exceptions sent to honeybadger.
|
87
|
-
|
88
|
-
The Proc must accept an `exception` argument that will be the exception in question and must always return an array of strings (the array can be empty).
|
89
|
-
|
90
|
-
Example to enable auto-tagging:
|
91
|
-
```ruby
|
92
|
-
ExceptionHandling.honeybadger_auto_tagger = ->(exception) do
|
93
|
-
exception.message.match?(/fire/) ? ["high-urgency", "danger"] : ["low-urgency"]
|
94
|
-
end
|
95
|
-
```
|
96
|
-
|
97
|
-
Example to disable auto-tagging:
|
98
|
-
```ruby
|
99
|
-
ExceptionHandling.honeybadger_auto_tagger = nil
|
100
|
-
```
|
101
|
-
|
102
|
-
#### Automatically Tagging Exceptions from Log Context (`add_honeybadger_tag_from_log_context`)
|
103
|
-
|
104
|
-
Add a tag to exceptions sent to honeybadger based on a value in the log context.
|
105
|
-
|
106
|
-
To configure this, use the `add_honeybadger_tag_from_log_context` method.
|
107
|
-
```ruby
|
108
|
-
ExceptionHandling.add_honeybadger_tag_from_log_context("kubernetes_context", path: ["kubernetes", "context"])
|
109
|
-
```
|
110
|
-
|
111
|
-
This will add a tag to the exception if the log context contains a value at the specified path: "kubernetes" => { "context" => "value" }.
|
112
|
-
|
113
|
-
For example:
|
114
|
-
```ruby
|
115
|
-
ExceptionHandling.logger.with_context("kubernetes" => { "context" => "local" }) do
|
116
|
-
log_error(ex, "A specific error occurred.")
|
117
|
-
end
|
118
|
-
```
|
119
|
-
|
120
|
-
This will add the following tag to the exception sent to honeybadger:
|
121
|
-
```
|
122
|
-
kubernetes_context:local
|
123
|
-
```
|
124
|
-
|
125
|
-
To clear all automated tagging from the log context, use the `clear_honeybadger_tags_from_log_context` method.
|
126
|
-
```ruby
|
127
|
-
ExceptionHandling.clear_honeybadger_tags_from_log_context
|
128
|
-
```
|
129
|
-
|
130
61
|
## Custom Hooks
|
131
62
|
|
132
63
|
### custom_data_hook
|
@@ -158,15 +89,15 @@ There is another hook available intended for custom actions after an error email
|
|
158
89
|
else
|
159
90
|
Invoca::Metrics::Client.metrics.counter("exception_handling/exception")
|
160
91
|
end
|
161
|
-
|
92
|
+
|
162
93
|
case honeybadger_status
|
163
94
|
when :success
|
164
95
|
Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.success")
|
165
|
-
when :failure
|
96
|
+
when :failure
|
166
97
|
Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.failure")
|
167
98
|
when :skipped
|
168
99
|
Invoca::Metrics::Client.metrics.counter("exception_handling.honeybadger.skipped")
|
169
|
-
end
|
100
|
+
end
|
170
101
|
end
|
171
102
|
ExceptionHandling.post_log_error_hook = method(:log_error_metrics)
|
172
103
|
|
data/Rakefile
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require 'rake/testtask'
|
5
4
|
require "bundler/gem_tasks"
|
5
|
+
require 'rake/testtask'
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
namespace :test do
|
8
|
+
Rake::TestTask.new do |t|
|
9
|
+
t.name = :unit
|
10
|
+
t.libs << "test"
|
11
|
+
t.pattern = 'test/unit/**/*_test.rb'
|
12
|
+
t.verbose = true
|
13
|
+
end
|
14
|
+
Rake::Task['test:unit'].comment = "Run the unit tests"
|
13
15
|
end
|
14
16
|
|
15
|
-
task
|
17
|
+
task test: 'test:unit'
|
18
|
+
task default: 'test'
|
data/exception_handling.gemspec
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
require File.expand_path('lib/exception_handling/version', __dir__)
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.authors = ["
|
7
|
-
spec.email = ["
|
6
|
+
spec.authors = ["Colin Kelley"]
|
7
|
+
spec.email = ["colindkelley@gmail.com"]
|
8
8
|
spec.description = 'Exception handling logger/emailer'
|
9
9
|
spec.summary = "Invoca's exception handling logger/emailer layer, based on exception_notifier. Works with Rails or EventMachine or EventMachine+Synchrony."
|
10
10
|
spec.homepage = "https://github.com/Invoca/exception_handling"
|
11
11
|
|
12
|
-
spec.files = `git ls-files`.split(
|
12
|
+
spec.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR)
|
13
13
|
spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
14
14
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/.*\.rb})
|
15
15
|
spec.name = "exception_handling"
|
@@ -20,15 +20,11 @@ Gem::Specification.new do |spec|
|
|
20
20
|
"allowed_push_host" => "https://rubygems.org"
|
21
21
|
}
|
22
22
|
|
23
|
-
spec.
|
24
|
-
|
25
|
-
spec.add_dependency '
|
26
|
-
spec.add_dependency '
|
27
|
-
spec.add_dependency '
|
28
|
-
spec.add_dependency '
|
29
|
-
spec.add_dependency '
|
30
|
-
spec.add_dependency 'eventmachine', '~> 1.0'
|
31
|
-
spec.add_dependency 'invoca-utils', '~> 0.3'
|
32
|
-
spec.add_dependency 'psych', '~> 3.0'
|
33
|
-
spec.add_dependency 'net-smtp'
|
23
|
+
spec.add_dependency 'actionmailer', '~> 4.2'
|
24
|
+
spec.add_dependency 'actionpack', '~> 4.2'
|
25
|
+
spec.add_dependency 'activesupport', '~> 4.2'
|
26
|
+
spec.add_dependency 'contextual_logger'
|
27
|
+
spec.add_dependency 'eventmachine', '~> 1.0'
|
28
|
+
spec.add_dependency 'hobo_support'
|
29
|
+
spec.add_dependency 'invoca-utils', '~> 0.0'
|
34
30
|
end
|