exception_notification 4.2.0 → 4.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Appraisals +4 -3
- data/CHANGELOG.rdoc +57 -1
- data/CONTRIBUTING.md +21 -2
- data/Gemfile +3 -1
- data/README.md +106 -789
- data/Rakefile +4 -2
- data/docs/notifiers/campfire.md +50 -0
- data/docs/notifiers/custom.md +42 -0
- data/docs/notifiers/datadog.md +51 -0
- data/docs/notifiers/email.md +195 -0
- data/docs/notifiers/google_chat.md +31 -0
- data/docs/notifiers/hipchat.md +66 -0
- data/docs/notifiers/irc.md +97 -0
- data/docs/notifiers/mattermost.md +115 -0
- data/docs/notifiers/slack.md +161 -0
- data/docs/notifiers/sns.md +37 -0
- data/docs/notifiers/teams.md +54 -0
- data/docs/notifiers/webhook.md +60 -0
- data/examples/sample_app.rb +56 -0
- data/examples/sinatra/Gemfile +8 -6
- data/examples/sinatra/config.ru +3 -1
- data/examples/sinatra/sinatra_app.rb +19 -11
- data/exception_notification.gemspec +30 -23
- data/gemfiles/rails4_0.gemfile +1 -2
- data/gemfiles/rails4_1.gemfile +1 -2
- data/gemfiles/rails4_2.gemfile +1 -2
- data/gemfiles/rails5_0.gemfile +1 -2
- data/gemfiles/rails5_1.gemfile +7 -0
- data/gemfiles/rails5_2.gemfile +7 -0
- data/gemfiles/rails6_0.gemfile +7 -0
- data/lib/exception_notification.rb +3 -0
- data/lib/exception_notification/rack.rb +34 -27
- data/lib/exception_notification/rails.rb +3 -0
- data/lib/exception_notification/resque.rb +10 -10
- data/lib/exception_notification/sidekiq.rb +10 -12
- data/lib/exception_notification/version.rb +5 -0
- data/lib/exception_notifier.rb +79 -11
- data/lib/exception_notifier/base_notifier.rb +10 -5
- data/lib/exception_notifier/campfire_notifier.rb +14 -9
- data/lib/exception_notifier/datadog_notifier.rb +156 -0
- data/lib/exception_notifier/email_notifier.rb +78 -87
- data/lib/exception_notifier/google_chat_notifier.rb +44 -0
- data/lib/exception_notifier/hipchat_notifier.rb +16 -10
- data/lib/exception_notifier/irc_notifier.rb +38 -31
- data/lib/exception_notifier/mattermost_notifier.rb +54 -131
- data/lib/exception_notifier/modules/backtrace_cleaner.rb +2 -2
- data/lib/exception_notifier/modules/error_grouping.rb +87 -0
- data/lib/exception_notifier/modules/formatter.rb +121 -0
- data/lib/exception_notifier/notifier.rb +9 -6
- data/lib/exception_notifier/slack_notifier.rb +75 -32
- data/lib/exception_notifier/sns_notifier.rb +86 -0
- data/lib/exception_notifier/teams_notifier.rb +200 -0
- data/lib/exception_notifier/views/exception_notifier/_backtrace.html.erb +1 -1
- data/lib/exception_notifier/views/exception_notifier/_environment.text.erb +1 -1
- data/lib/exception_notifier/views/exception_notifier/_request.text.erb +1 -1
- data/lib/exception_notifier/views/exception_notifier/background_exception_notification.text.erb +9 -9
- data/lib/exception_notifier/views/exception_notifier/exception_notification.html.erb +2 -4
- data/lib/exception_notifier/views/exception_notifier/exception_notification.text.erb +2 -2
- data/lib/exception_notifier/webhook_notifier.rb +19 -16
- data/lib/generators/exception_notification/install_generator.rb +11 -5
- data/lib/generators/exception_notification/templates/{exception_notification.rb → exception_notification.rb.erb} +14 -12
- data/test/exception_notification/rack_test.rb +90 -4
- data/test/exception_notification/resque_test.rb +54 -0
- data/test/exception_notifier/campfire_notifier_test.rb +66 -39
- data/test/exception_notifier/datadog_notifier_test.rb +153 -0
- data/test/exception_notifier/email_notifier_test.rb +301 -145
- data/test/exception_notifier/google_chat_notifier_test.rb +185 -0
- data/test/exception_notifier/hipchat_notifier_test.rb +112 -65
- data/test/exception_notifier/irc_notifier_test.rb +48 -30
- data/test/exception_notifier/mattermost_notifier_test.rb +218 -55
- data/test/exception_notifier/modules/error_grouping_test.rb +167 -0
- data/test/exception_notifier/modules/formatter_test.rb +152 -0
- data/test/exception_notifier/sidekiq_test.rb +9 -6
- data/test/exception_notifier/slack_notifier_test.rb +109 -59
- data/test/exception_notifier/sns_notifier_test.rb +123 -0
- data/test/exception_notifier/teams_notifier_test.rb +92 -0
- data/test/exception_notifier/webhook_notifier_test.rb +68 -38
- data/test/exception_notifier_test.rb +220 -37
- data/test/support/exception_notifier_helper.rb +14 -0
- data/test/{dummy/app → support}/views/exception_notifier/_new_bkg_section.html.erb +0 -0
- data/test/{dummy/app → support}/views/exception_notifier/_new_bkg_section.text.erb +0 -0
- data/test/{dummy/app → support}/views/exception_notifier/_new_section.html.erb +0 -0
- data/test/{dummy/app → support}/views/exception_notifier/_new_section.text.erb +0 -0
- data/test/test_helper.rb +14 -13
- metadata +154 -162
- data/test/dummy/.gitignore +0 -4
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/controllers/posts_controller.rb +0 -30
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/helpers/posts_helper.rb +0 -2
- data/test/dummy/app/models/post.rb +0 -2
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/app/views/posts/_form.html.erb +0 -0
- data/test/dummy/app/views/posts/new.html.erb +0 -0
- data/test/dummy/app/views/posts/show.html.erb +0 -0
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -42
- data/test/dummy/config/boot.rb +0 -6
- data/test/dummy/config/database.yml +0 -22
- data/test/dummy/config/environment.rb +0 -17
- data/test/dummy/config/environments/development.rb +0 -25
- data/test/dummy/config/environments/production.rb +0 -50
- data/test/dummy/config/environments/test.rb +0 -38
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -10
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -8
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -3
- data/test/dummy/db/migrate/20110729022608_create_posts.rb +0 -15
- data/test/dummy/db/schema.rb +0 -24
- data/test/dummy/db/seeds.rb +0 -7
- data/test/dummy/lib/tasks/.gitkeep +0 -0
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -26
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/public/images/rails.png +0 -0
- data/test/dummy/public/index.html +0 -239
- data/test/dummy/public/javascripts/application.js +0 -2
- data/test/dummy/public/javascripts/controls.js +0 -965
- data/test/dummy/public/javascripts/dragdrop.js +0 -974
- data/test/dummy/public/javascripts/effects.js +0 -1123
- data/test/dummy/public/javascripts/prototype.js +0 -6001
- data/test/dummy/public/javascripts/rails.js +0 -191
- data/test/dummy/public/robots.txt +0 -5
- data/test/dummy/public/stylesheets/.gitkeep +0 -0
- data/test/dummy/public/stylesheets/scaffold.css +0 -56
- data/test/dummy/script/rails +0 -6
- data/test/dummy/test/functional/posts_controller_test.rb +0 -218
- data/test/dummy/test/test_helper.rb +0 -7
data/Rakefile
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rubygems'
|
2
4
|
require 'bundler/setup'
|
3
5
|
Bundler::GemHelper.install_tasks
|
@@ -5,11 +7,11 @@ require 'appraisal'
|
|
5
7
|
|
6
8
|
require 'rake/testtask'
|
7
9
|
|
8
|
-
task :
|
10
|
+
task default: [:test]
|
9
11
|
|
10
12
|
Rake::TestTask.new(:test) do |t|
|
11
13
|
t.libs << 'lib'
|
12
14
|
t.libs << 'test'
|
13
15
|
t.pattern = 'test/**/*_test.rb'
|
14
|
-
t.
|
16
|
+
t.warning = false
|
15
17
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
### Campfire notifier
|
2
|
+
|
3
|
+
This notifier sends notifications to your Campfire room.
|
4
|
+
|
5
|
+
#### Usage
|
6
|
+
|
7
|
+
Just add the [tinder](https://github.com/collectiveidea/tinder) gem to your `Gemfile`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'tinder'
|
11
|
+
```
|
12
|
+
|
13
|
+
To configure it, you need to set the `subdomain`, `token` and `room_name` options, like this:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
17
|
+
email: {
|
18
|
+
email_prefix: '[PREFIX] ',
|
19
|
+
sender_address: %{"notifier" <notifier@example.com>},
|
20
|
+
exception_recipients: %w{exceptions@example.com}
|
21
|
+
},
|
22
|
+
campfire: {
|
23
|
+
subdomain: 'my_subdomain',
|
24
|
+
token: 'my_token',
|
25
|
+
room_name: 'my_room'
|
26
|
+
}
|
27
|
+
```
|
28
|
+
|
29
|
+
#### Options
|
30
|
+
|
31
|
+
##### subdomain
|
32
|
+
|
33
|
+
*String, required*
|
34
|
+
|
35
|
+
Your subdomain at Campfire.
|
36
|
+
|
37
|
+
##### room_name
|
38
|
+
|
39
|
+
*String, required*
|
40
|
+
|
41
|
+
The Campfire room where the notifications must be published to.
|
42
|
+
|
43
|
+
##### token
|
44
|
+
|
45
|
+
*String, required*
|
46
|
+
|
47
|
+
The API token to allow access to your Campfire account.
|
48
|
+
|
49
|
+
|
50
|
+
For more options to set Campfire, like _ssl_, check [here](https://github.com/collectiveidea/tinder/blob/master/lib/tinder/campfire.rb#L17).
|
@@ -0,0 +1,42 @@
|
|
1
|
+
### Custom notifier
|
2
|
+
|
3
|
+
Simply put, notifiers are objects which respond to `#call(exception, options)` method. Thus, a lambda can be used as a notifier as follow:
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
ExceptionNotifier.add_notifier :custom_notifier_name,
|
7
|
+
->(exception, options) { puts "Something goes wrong: #{exception.message}"}
|
8
|
+
```
|
9
|
+
|
10
|
+
More advanced users or third-party framework developers, also can create notifiers to be shipped in gems and take advantage of ExceptionNotification's Notifier API to standardize the [various](https://github.com/airbrake/airbrake) [solutions](https://www.honeybadger.io) [out](http://www.exceptional.io) [there](https://bugsnag.com). For this, beyond the `#call(exception, options)` method, the notifier class MUST BE defined under the ExceptionNotifier namespace and its name sufixed by `Notifier`, e.g: ExceptionNotifier::SimpleNotifier.
|
11
|
+
|
12
|
+
#### Example
|
13
|
+
|
14
|
+
Define the custom notifier:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
module ExceptionNotifier
|
18
|
+
class SimpleNotifier
|
19
|
+
def initialize(options)
|
20
|
+
# do something with the options...
|
21
|
+
end
|
22
|
+
|
23
|
+
def call(exception, options={})
|
24
|
+
# send the notification
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
```
|
29
|
+
|
30
|
+
Using it:
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
34
|
+
email: {
|
35
|
+
email_prefix: '[PREFIX] ',
|
36
|
+
sender_address: %{"notifier" <notifier@example.com>},
|
37
|
+
exception_recipients: %w{exceptions@example.com}
|
38
|
+
},
|
39
|
+
simple: {
|
40
|
+
# simple notifier options
|
41
|
+
}
|
42
|
+
```
|
@@ -0,0 +1,51 @@
|
|
1
|
+
### Datadog notifier
|
2
|
+
|
3
|
+
This notifier sends error events to Datadog using the [Dogapi](https://github.com/DataDog/dogapi-rb) gem.
|
4
|
+
|
5
|
+
#### Usage
|
6
|
+
|
7
|
+
Just add the [Dogapi](https://github.com/DataDog/dogapi-rb) gem to your `Gemfile`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'dogapi'
|
11
|
+
```
|
12
|
+
|
13
|
+
To use datadog notifier, you first need to create a `Dogapi::Client` with your datadog api and application keys, like this:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
client = Dogapi::Client.new(api_key, application_key)
|
17
|
+
```
|
18
|
+
|
19
|
+
You then need to set the `client` option, like this:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
23
|
+
email: {
|
24
|
+
email_prefix: "[PREFIX] ",
|
25
|
+
sender_address: %{"notifier" <notifier@example.com>},
|
26
|
+
exception_recipients: %w{exceptions@example.com}
|
27
|
+
},
|
28
|
+
datadog: {
|
29
|
+
client: client
|
30
|
+
}
|
31
|
+
```
|
32
|
+
|
33
|
+
#### Options
|
34
|
+
|
35
|
+
##### client
|
36
|
+
|
37
|
+
*DogApi::Client, required*
|
38
|
+
|
39
|
+
The API client to send events to Datadog.
|
40
|
+
|
41
|
+
##### title_prefix
|
42
|
+
|
43
|
+
*String, optional*
|
44
|
+
|
45
|
+
Prefix for event title in Datadog.
|
46
|
+
|
47
|
+
##### tags
|
48
|
+
|
49
|
+
*Array of Strings, optional*
|
50
|
+
|
51
|
+
Optional tags for events in Datadog.
|
@@ -0,0 +1,195 @@
|
|
1
|
+
### Email notifier
|
2
|
+
|
3
|
+
The Email notifier sends notifications by email. The notifications/emails sent includes information about the current request, session, and environment, and also gives a backtrace of the exception.
|
4
|
+
|
5
|
+
After an exception notification has been delivered the rack environment variable `exception_notifier.delivered` will be set to true.
|
6
|
+
|
7
|
+
#### ActionMailer configuration
|
8
|
+
|
9
|
+
For the email to be sent, there must be a default ActionMailer `delivery_method` setting configured. If you do not have one, you can use the following code (assuming your app server machine has `sendmail`). Depending on the environment you want ExceptionNotification to run in, put the following code in your `config/environments/production.rb` and/or `config/environments/development.rb`:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
config.action_mailer.delivery_method = :sendmail
|
13
|
+
# Defaults to:
|
14
|
+
# config.action_mailer.sendmail_settings = {
|
15
|
+
# location: '/usr/sbin/sendmail',
|
16
|
+
# arguments: '-i -t'
|
17
|
+
# }
|
18
|
+
config.action_mailer.perform_deliveries = true
|
19
|
+
config.action_mailer.raise_delivery_errors = true
|
20
|
+
```
|
21
|
+
|
22
|
+
#### Options
|
23
|
+
|
24
|
+
##### sender_address
|
25
|
+
|
26
|
+
*String, default: %("Exception Notifier" <exception.notifier@example.com>)*
|
27
|
+
|
28
|
+
Who the message is from.
|
29
|
+
|
30
|
+
##### exception_recipients
|
31
|
+
|
32
|
+
*String/Array of strings/Proc, default: []*
|
33
|
+
|
34
|
+
Who the message is destined for, can be a string of addresses, an array of addresses, or it can be a proc that returns a string of addresses or an array of addresses. The proc will be evaluated when the mail is sent.
|
35
|
+
|
36
|
+
##### email_prefix
|
37
|
+
|
38
|
+
*String, default: [ERROR]*
|
39
|
+
|
40
|
+
The subject's prefix of the message.
|
41
|
+
|
42
|
+
##### sections
|
43
|
+
|
44
|
+
*Array of strings, default: %w(request session environment backtrace)*
|
45
|
+
|
46
|
+
By default, the notification email includes four parts: request, session, environment, and backtrace (in that order). You can customize how each of those sections are rendered by placing a partial named for that part in your `app/views/exception_notifier` directory (e.g., `_session.rhtml`). Each partial has access to the following variables:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
@kontroller # the controller that caused the error
|
50
|
+
@request # the current request object
|
51
|
+
@exception # the exception that was raised
|
52
|
+
@backtrace # a sanitized version of the exception's backtrace
|
53
|
+
@data # a hash of optional data values that were passed to the notifier
|
54
|
+
@sections # the array of sections to include in the email
|
55
|
+
```
|
56
|
+
|
57
|
+
You can reorder the sections, or exclude sections completely, by using `sections` option. You can even add new sections that
|
58
|
+
describe application-specific data--just add the section's name to the list (wherever you'd like), and define the corresponding partial. Like the following example with two new added sections:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
62
|
+
email: {
|
63
|
+
email_prefix: '[PREFIX] ',
|
64
|
+
sender_address: %{"notifier" <notifier@example.com>},
|
65
|
+
exception_recipients: %w{exceptions@example.com},
|
66
|
+
sections: %w{my_section1 my_section2}
|
67
|
+
}
|
68
|
+
```
|
69
|
+
|
70
|
+
Place your custom sections under `./app/views/exception_notifier/` with the suffix `.text.erb`, e.g. `./app/views/exception_notifier/_my_section1.text.erb`.
|
71
|
+
|
72
|
+
If your new section requires information that isn't available by default, make sure it is made available to the email using the `exception_data` macro:
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
class ApplicationController < ActionController::Base
|
76
|
+
before_action :log_additional_data
|
77
|
+
...
|
78
|
+
protected
|
79
|
+
|
80
|
+
def log_additional_data
|
81
|
+
request.env['exception_notifier.exception_data'] = {
|
82
|
+
document: @document,
|
83
|
+
person: @person
|
84
|
+
}
|
85
|
+
end
|
86
|
+
...
|
87
|
+
end
|
88
|
+
```
|
89
|
+
|
90
|
+
In the above case, `@document` and `@person` would be made available to the email renderer, allowing your new section(s) to access and display them. See the existing sections defined by the plugin for examples of how to write your own.
|
91
|
+
|
92
|
+
##### background_sections
|
93
|
+
|
94
|
+
*Array of strings, default: %w(backtrace data)*
|
95
|
+
|
96
|
+
When using [background notifications](#background-notifications) some variables are not available in the views, like `@kontroller` and `@request`. Thus, you may want to include different sections for background notifications:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
100
|
+
email: {
|
101
|
+
email_prefix: '[PREFIX] ',
|
102
|
+
sender_address: %{"notifier" <notifier@example.com>},
|
103
|
+
exception_recipients: %w{exceptions@example.com},
|
104
|
+
background_sections: %w{my_section1 my_section2 backtrace data}
|
105
|
+
}
|
106
|
+
```
|
107
|
+
|
108
|
+
##### email_headers
|
109
|
+
|
110
|
+
*Hash of strings, default: {}*
|
111
|
+
|
112
|
+
Additionally, you may want to set customized headers on the outcoming emails. To do so, simply use the `:email_headers` option:
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
116
|
+
email: {
|
117
|
+
email_prefix: "[PREFIX] ",
|
118
|
+
sender_address: %{"notifier" <notifier@example.com>},
|
119
|
+
exception_recipients: %w{exceptions@example.com},
|
120
|
+
email_headers: { "X-Custom-Header" => "foobar" }
|
121
|
+
}
|
122
|
+
```
|
123
|
+
|
124
|
+
##### verbose_subject
|
125
|
+
|
126
|
+
*Boolean, default: true*
|
127
|
+
|
128
|
+
If enabled, include the exception message in the subject. Use `verbose_subject: false` to exclude it.
|
129
|
+
|
130
|
+
##### normalize_subject
|
131
|
+
|
132
|
+
*Boolean, default: false*
|
133
|
+
|
134
|
+
If enabled, remove numbers from subject so they thread as a single one. Use `normalize_subject: true` to enable it.
|
135
|
+
|
136
|
+
##### include_controller_and_action_names_in_subject
|
137
|
+
|
138
|
+
*Boolean, default: true*
|
139
|
+
|
140
|
+
If enabled, include the controller and action names in the subject. Use `include_controller_and_action_names_in_subject: false` to exclude them.
|
141
|
+
|
142
|
+
##### email_format
|
143
|
+
|
144
|
+
*Symbol, default: :text*
|
145
|
+
|
146
|
+
By default, ExceptionNotification sends emails in plain text, in order to sends multipart notifications (aka HTML emails) use `email_format: :html`.
|
147
|
+
|
148
|
+
##### delivery_method
|
149
|
+
|
150
|
+
*Symbol, default: :smtp*
|
151
|
+
|
152
|
+
By default, ExceptionNotification sends emails using the ActionMailer configuration of the application. In order to send emails by another delivery method, use the `delivery_method` option:
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
156
|
+
email: {
|
157
|
+
email_prefix: '[PREFIX] ',
|
158
|
+
sender_address: %{"notifier" <notifier@example.com>},
|
159
|
+
exception_recipients: %w{exceptions@example.com},
|
160
|
+
delivery_method: :postmark,
|
161
|
+
postmark_settings: {
|
162
|
+
api_key: ENV['POSTMARK_API_KEY']
|
163
|
+
}
|
164
|
+
}
|
165
|
+
```
|
166
|
+
|
167
|
+
Besides the `delivery_method` option, you also can customize the mailer settings by passing a hash under an option named `DELIVERY_METHOD_settings`. Thus, you can use override specific SMTP settings for notifications using:
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
171
|
+
email: {
|
172
|
+
email_prefix: '[PREFIX] ',
|
173
|
+
sender_address: %{"notifier" <notifier@example.com>},
|
174
|
+
exception_recipients: %w{exceptions@example.com},
|
175
|
+
delivery_method: :smtp,
|
176
|
+
smtp_settings: {
|
177
|
+
user_name: 'bob',
|
178
|
+
password: 'password',
|
179
|
+
}
|
180
|
+
}
|
181
|
+
```
|
182
|
+
|
183
|
+
A complete list of `smtp_settings` options can be found in the [ActionMailer Configuration documentation](http://api.rubyonrails.org/classes/ActionMailer/Base.html#class-ActionMailer::Base-label-Configuration+options).
|
184
|
+
|
185
|
+
##### mailer_parent
|
186
|
+
|
187
|
+
*String, default: ActionMailer::Base*
|
188
|
+
|
189
|
+
The parent mailer which ExceptionNotification mailer inherit from.
|
190
|
+
|
191
|
+
##### deliver_with
|
192
|
+
|
193
|
+
*Symbol, default: :deliver_now
|
194
|
+
|
195
|
+
The method name to send emalis using ActionMailer.
|
@@ -0,0 +1,31 @@
|
|
1
|
+
### Google Chat Notifier
|
2
|
+
|
3
|
+
Post notifications in a Google Chats channel via [incoming webhook](https://developers.google.com/hangouts/chat/how-tos/webhooks)
|
4
|
+
|
5
|
+
Add the [HTTParty](https://github.com/jnunemaker/httparty) gem to your `Gemfile`:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'httparty'
|
9
|
+
```
|
10
|
+
|
11
|
+
To configure it, you **need** to set the `webhook_url` option.
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
15
|
+
google_chat: {
|
16
|
+
webhook_url: 'https://chat.googleapis.com/v1/spaces/XXXXXXXX/messages?key=YYYYYYYYYYYYY&token=ZZZZZZZZZZZZ'
|
17
|
+
}
|
18
|
+
```
|
19
|
+
|
20
|
+
##### webhook_url
|
21
|
+
|
22
|
+
*String, required*
|
23
|
+
|
24
|
+
The Incoming WebHook URL on Google Chats.
|
25
|
+
|
26
|
+
##### app_name
|
27
|
+
|
28
|
+
*String, optional*
|
29
|
+
|
30
|
+
Your application name, shown in the notification. Defaults to `Rails.application.class.module_parent_name.underscore` for Rails versions >= 6;
|
31
|
+
`Rails.application.class.parent_name.underscore` otherwise.
|
@@ -0,0 +1,66 @@
|
|
1
|
+
### HipChat notifier
|
2
|
+
|
3
|
+
This notifier sends notifications to your Hipchat room.
|
4
|
+
|
5
|
+
#### Usage
|
6
|
+
|
7
|
+
Just add the [hipchat](https://github.com/hipchat/hipchat-rb) gem to your `Gemfile`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'hipchat'
|
11
|
+
```
|
12
|
+
|
13
|
+
To configure it, you need to set the `token` and `room_name` options, like this:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
17
|
+
email: {
|
18
|
+
email_prefix: '[PREFIX] ',
|
19
|
+
sender_address: %{"notifier" <notifier@example.com>},
|
20
|
+
exception_recipients: %w{exceptions@example.com}
|
21
|
+
},
|
22
|
+
hipchat: {
|
23
|
+
api_token: 'my_token',
|
24
|
+
room_name: 'my_room'
|
25
|
+
}
|
26
|
+
```
|
27
|
+
|
28
|
+
#### Options
|
29
|
+
|
30
|
+
##### room_name
|
31
|
+
|
32
|
+
*String, required*
|
33
|
+
|
34
|
+
The HipChat room where the notifications must be published to.
|
35
|
+
|
36
|
+
##### api_token
|
37
|
+
|
38
|
+
*String, required*
|
39
|
+
|
40
|
+
The API token to allow access to your HipChat account.
|
41
|
+
|
42
|
+
##### notify
|
43
|
+
|
44
|
+
*Boolean, optional*
|
45
|
+
|
46
|
+
Notify users. Default : false.
|
47
|
+
|
48
|
+
##### color
|
49
|
+
|
50
|
+
*String, optional*
|
51
|
+
|
52
|
+
Color of the message. Default : 'red'.
|
53
|
+
|
54
|
+
##### from
|
55
|
+
|
56
|
+
*String, optional, maximum length : 15*
|
57
|
+
|
58
|
+
Message will appear from this nickname. Default : 'Exception'.
|
59
|
+
|
60
|
+
##### server_url
|
61
|
+
|
62
|
+
*String, optional*
|
63
|
+
|
64
|
+
Custom Server URL for self-hosted, Enterprise HipChat Server
|
65
|
+
|
66
|
+
For all options & possible values see [Hipchat API](https://www.hipchat.com/docs/api/method/rooms/message).
|