exception_notification 4.3.0 → 4.4.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.
- checksums.yaml +4 -4
- data/Appraisals +2 -2
- data/CHANGELOG.rdoc +14 -0
- data/CONTRIBUTING.md +18 -0
- data/Gemfile +1 -1
- data/README.md +64 -935
- data/Rakefile +2 -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 +54 -0
- data/examples/sinatra/Gemfile +6 -6
- data/examples/sinatra/config.ru +1 -1
- data/examples/sinatra/sinatra_app.rb +14 -10
- data/exception_notification.gemspec +27 -22
- data/gemfiles/rails4_0.gemfile +3 -3
- data/gemfiles/rails4_1.gemfile +3 -3
- data/gemfiles/rails4_2.gemfile +3 -3
- data/gemfiles/rails5_0.gemfile +3 -3
- data/gemfiles/rails5_1.gemfile +3 -3
- data/gemfiles/rails5_2.gemfile +7 -0
- data/gemfiles/rails6_0.gemfile +7 -0
- data/lib/exception_notification.rb +1 -0
- data/lib/exception_notification/rack.rb +8 -21
- data/lib/exception_notification/resque.rb +8 -10
- data/lib/exception_notification/sidekiq.rb +8 -12
- data/lib/exception_notification/version.rb +3 -0
- data/lib/exception_notifier.rb +20 -3
- data/lib/exception_notifier/base_notifier.rb +2 -3
- data/lib/exception_notifier/campfire_notifier.rb +12 -13
- data/lib/exception_notifier/datadog_notifier.rb +153 -0
- data/lib/exception_notifier/email_notifier.rb +64 -87
- data/lib/exception_notifier/google_chat_notifier.rb +25 -119
- data/lib/exception_notifier/hipchat_notifier.rb +11 -12
- data/lib/exception_notifier/irc_notifier.rb +32 -30
- data/lib/exception_notifier/mattermost_notifier.rb +47 -140
- data/lib/exception_notifier/modules/backtrace_cleaner.rb +0 -2
- data/lib/exception_notifier/modules/error_grouping.rb +5 -5
- data/lib/exception_notifier/modules/formatter.rb +118 -0
- data/lib/exception_notifier/notifier.rb +5 -6
- data/lib/exception_notifier/slack_notifier.rb +63 -40
- data/lib/exception_notifier/sns_notifier.rb +17 -11
- data/lib/exception_notifier/teams_notifier.rb +58 -44
- 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/exception_notification.html.erb +2 -2
- data/lib/exception_notifier/views/exception_notifier/exception_notification.text.erb +2 -2
- data/lib/exception_notifier/webhook_notifier.rb +14 -11
- data/lib/generators/exception_notification/install_generator.rb +5 -5
- data/lib/generators/exception_notification/templates/{exception_notification.rb → exception_notification.rb.erb} +13 -11
- data/test/exception_notification/rack_test.rb +27 -11
- data/test/exception_notification/resque_test.rb +52 -0
- data/test/exception_notifier/campfire_notifier_test.rb +42 -42
- data/test/exception_notifier/datadog_notifier_test.rb +151 -0
- data/test/exception_notifier/email_notifier_test.rb +269 -153
- data/test/exception_notifier/google_chat_notifier_test.rb +154 -101
- data/test/exception_notifier/hipchat_notifier_test.rb +78 -81
- data/test/exception_notifier/irc_notifier_test.rb +34 -34
- data/test/exception_notifier/mattermost_notifier_test.rb +164 -67
- data/test/exception_notifier/modules/error_grouping_test.rb +39 -40
- data/test/exception_notifier/modules/formatter_test.rb +150 -0
- data/test/exception_notifier/sidekiq_test.rb +6 -6
- data/test/exception_notifier/slack_notifier_test.rb +61 -60
- data/test/exception_notifier/sns_notifier_test.rb +27 -32
- data/test/exception_notifier/teams_notifier_test.rb +23 -26
- data/test/exception_notifier/webhook_notifier_test.rb +48 -46
- data/test/exception_notifier_test.rb +41 -38
- 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 +11 -14
- metadata +136 -166
- 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 -35
- 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 -237
- data/test/dummy/test/test_helper.rb +0 -7
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
### IRC notifier
|
|
2
|
+
|
|
3
|
+
This notifier sends notifications to an IRC channel using the carrier-pigeon gem.
|
|
4
|
+
|
|
5
|
+
#### Usage
|
|
6
|
+
|
|
7
|
+
Just add the [carrier-pigeon](https://github.com/portertech/carrier-pigeon) gem to your `Gemfile`:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'carrier-pigeon'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
To configure it, you need to set at least the 'domain' option, 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
|
+
irc: {
|
|
23
|
+
domain: 'irc.example.com'
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
There are several other options, which are described below. For example, to use ssl and a password, add a prefix, post to the '#log' channel, and include recipients in the message (so that they will be notified), your configuration might look like this:
|
|
28
|
+
|
|
29
|
+
```ruby
|
|
30
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
|
31
|
+
irc: {
|
|
32
|
+
domain: 'irc.example.com',
|
|
33
|
+
nick: 'BadNewsBot',
|
|
34
|
+
password: 'secret',
|
|
35
|
+
port: 6697,
|
|
36
|
+
channel: '#log',
|
|
37
|
+
ssl: true,
|
|
38
|
+
prefix: '[Exception Notification]',
|
|
39
|
+
recipients: ['peter', 'michael', 'samir']
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
#### Options
|
|
44
|
+
|
|
45
|
+
##### domain
|
|
46
|
+
|
|
47
|
+
*String, required*
|
|
48
|
+
|
|
49
|
+
The domain name of your IRC server.
|
|
50
|
+
|
|
51
|
+
##### nick
|
|
52
|
+
|
|
53
|
+
*String, optional*
|
|
54
|
+
|
|
55
|
+
The message will appear from this nick. Default : 'ExceptionNotifierBot'.
|
|
56
|
+
|
|
57
|
+
##### password
|
|
58
|
+
|
|
59
|
+
*String, optional*
|
|
60
|
+
|
|
61
|
+
Password for your IRC server.
|
|
62
|
+
|
|
63
|
+
##### port
|
|
64
|
+
|
|
65
|
+
*String, optional*
|
|
66
|
+
|
|
67
|
+
Port your IRC server is listening on. Default : 6667.
|
|
68
|
+
|
|
69
|
+
##### channel
|
|
70
|
+
|
|
71
|
+
*String, optional*
|
|
72
|
+
|
|
73
|
+
Message will appear in this channel. Default : '#log'.
|
|
74
|
+
|
|
75
|
+
##### notice
|
|
76
|
+
|
|
77
|
+
*Boolean, optional*
|
|
78
|
+
|
|
79
|
+
Send a notice. Default : false.
|
|
80
|
+
|
|
81
|
+
##### ssl
|
|
82
|
+
|
|
83
|
+
*Boolean, optional*
|
|
84
|
+
|
|
85
|
+
Whether to use SSL. Default : false.
|
|
86
|
+
|
|
87
|
+
##### join
|
|
88
|
+
|
|
89
|
+
*Boolean, optional*
|
|
90
|
+
|
|
91
|
+
Join a channel. Default : false.
|
|
92
|
+
|
|
93
|
+
##### recipients
|
|
94
|
+
|
|
95
|
+
*Array of strings, optional*
|
|
96
|
+
|
|
97
|
+
Nicks to include in the message. Default: []
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
### Mattermost notifier
|
|
2
|
+
|
|
3
|
+
Post notification in a mattermost channel via [incoming webhook](http://docs.mattermost.com/developer/webhooks-incoming.html)
|
|
4
|
+
|
|
5
|
+
Just 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
|
+
You can also specify an other channel with `channel` option.
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
|
16
|
+
email: {
|
|
17
|
+
email_prefix: '[PREFIX] ',
|
|
18
|
+
sender_address: %{"notifier" <notifier@example.com>},
|
|
19
|
+
exception_recipients: %w{exceptions@example.com}
|
|
20
|
+
},
|
|
21
|
+
mattermost: {
|
|
22
|
+
webhook_url: 'http://your-mattermost.com/hooks/blablabla',
|
|
23
|
+
channel: 'my-channel'
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
If you are using Github or Gitlab for issues tracking, you can specify `git_url` as follow to add a *Create issue* link in you notification.
|
|
28
|
+
By default this will use your Rails application name to match the git repository. If yours differ you can specify `app_name`.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
```ruby
|
|
32
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
|
33
|
+
email: {
|
|
34
|
+
email_prefix: '[PREFIX] ',
|
|
35
|
+
sender_address: %{"notifier" <notifier@example.com>},
|
|
36
|
+
exception_recipients: %w{exceptions@example.com}
|
|
37
|
+
},
|
|
38
|
+
mattermost: {
|
|
39
|
+
webhook_url: 'http://your-mattermost.com/hooks/blablabla',
|
|
40
|
+
git_url: 'github.com/aschen'
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
You can also specify the bot name and avatar with `username` and `avatar` options.
|
|
45
|
+
|
|
46
|
+
```ruby
|
|
47
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
|
48
|
+
email: {
|
|
49
|
+
email_prefix: 'PREFIX] ',
|
|
50
|
+
sender_address: %{"notifier" <notifier@example.com>},
|
|
51
|
+
exception_recipients: %w{exceptions@example.com}
|
|
52
|
+
},
|
|
53
|
+
mattermost: {
|
|
54
|
+
webhook_url: 'http://your-mattermost.com/hooks/blablabla',
|
|
55
|
+
avatar: 'http://example.com/your-image.png',
|
|
56
|
+
username: 'Fail bot'
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Finally since the notifier use HTTParty, you can include all HTTParty options, like basic_auth for example.
|
|
61
|
+
|
|
62
|
+
```ruby
|
|
63
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
|
64
|
+
email: {
|
|
65
|
+
email_prefix: '[PREFIX] ',
|
|
66
|
+
sender_address: %{"notifier" <notifier@example.com>},
|
|
67
|
+
exception_recipients: %w{exceptions@example.com}
|
|
68
|
+
},
|
|
69
|
+
mattermost: {
|
|
70
|
+
webhook_url: 'http://your-mattermost.com/hooks/blablabla',
|
|
71
|
+
basic_auth: {
|
|
72
|
+
username: 'clara',
|
|
73
|
+
password: 'password'
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
#### Options
|
|
79
|
+
|
|
80
|
+
##### webhook_url
|
|
81
|
+
|
|
82
|
+
*String, required*
|
|
83
|
+
|
|
84
|
+
The Incoming WebHook URL on mattermost.
|
|
85
|
+
|
|
86
|
+
##### channel
|
|
87
|
+
|
|
88
|
+
*String, optional*
|
|
89
|
+
|
|
90
|
+
Message will appear in this channel. Defaults to the channel you set as such on mattermost.
|
|
91
|
+
|
|
92
|
+
##### username
|
|
93
|
+
|
|
94
|
+
*String, optional*
|
|
95
|
+
|
|
96
|
+
Username of the bot. Defaults to "Incoming Webhook"
|
|
97
|
+
|
|
98
|
+
##### avatar
|
|
99
|
+
|
|
100
|
+
*String, optional*
|
|
101
|
+
|
|
102
|
+
Avatar of the bot. Defaults to incoming webhook icon.
|
|
103
|
+
|
|
104
|
+
##### git_url
|
|
105
|
+
|
|
106
|
+
*String, optional*
|
|
107
|
+
|
|
108
|
+
Url of your gitlab or github with your organisation name for issue creation link (Eg: `github.com/aschen`). Defaults to nil and don't add link to the notification.
|
|
109
|
+
|
|
110
|
+
##### app_name
|
|
111
|
+
|
|
112
|
+
*String, optional*
|
|
113
|
+
|
|
114
|
+
Your application name used for issue creation link. Defaults to `Rails.application.class.module_parent_name.underscore` for Rails versions >= 6;
|
|
115
|
+
`Rails.application.class.parent_name.underscore` otherwise.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
### Slack notifier
|
|
2
|
+
|
|
3
|
+
This notifier sends notifications to a slack channel using the slack-notifier gem.
|
|
4
|
+
|
|
5
|
+
#### Usage
|
|
6
|
+
|
|
7
|
+
Just add the [slack-notifier](https://github.com/stevenosloan/slack-notifier) gem to your `Gemfile`:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'slack-notifier'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
To configure it, you need to set at least the 'webhook_url' option, 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
|
+
slack: {
|
|
23
|
+
webhook_url: '[Your webhook url]',
|
|
24
|
+
channel: '#exceptions',
|
|
25
|
+
additional_parameters: {
|
|
26
|
+
icon_url: 'http://image.jpg',
|
|
27
|
+
mrkdwn: true
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The slack notification will include any data saved under `env['exception_notifier.exception_data']`.
|
|
33
|
+
|
|
34
|
+
An example of how to send the server name to Slack in Rails (put this code in application_controller.rb):
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
before_action :set_notification
|
|
38
|
+
|
|
39
|
+
def set_notification
|
|
40
|
+
request.env['exception_notifier.exception_data'] = { 'server' => request.env['SERVER_NAME'] }
|
|
41
|
+
# can be any key-value pairs
|
|
42
|
+
end
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If you find this too verbose, you can determine to exclude certain information by doing the following:
|
|
46
|
+
|
|
47
|
+
```ruby
|
|
48
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
|
49
|
+
slack: {
|
|
50
|
+
webhook_url: '[Your webhook url]',
|
|
51
|
+
channel: '#exceptions',
|
|
52
|
+
additional_parameters: {
|
|
53
|
+
icon_url: 'http://image.jpg',
|
|
54
|
+
mrkdwn: true
|
|
55
|
+
},
|
|
56
|
+
ignore_data_if: lambda {|key, value|
|
|
57
|
+
"#{key}" == 'key_to_ignore' || value.is_a?(ClassToBeIgnored)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Any evaluation to `true` will cause the key / value pair not be be sent along to Slack.
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
the `slack-notifier` gem allows to override the channel default value, if you ever
|
|
66
|
+
need to send a notification to a different slack channel. Simply add the
|
|
67
|
+
`channel` option when calling `.notify_exception`
|
|
68
|
+
|
|
69
|
+
```ruby
|
|
70
|
+
ExceptionNotifier.notify_exception(
|
|
71
|
+
exception,
|
|
72
|
+
env: request.env,
|
|
73
|
+
channel: '#my-custom-channel', # Make sure the channel name starts with `#`
|
|
74
|
+
data: {
|
|
75
|
+
error: error_variable,
|
|
76
|
+
server: server_name
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
If you ever need to add more `slack-notifier` specific options, and
|
|
82
|
+
particularly to the `#ping` method of the slack notifier, you can use
|
|
83
|
+
the `pre_callback` option when defining the middleware.
|
|
84
|
+
```ruby
|
|
85
|
+
pre_callback: proc { |opts, _notifier, _backtrace, _message, message_opts|
|
|
86
|
+
message_opts[:channel] = opts[:channel] if opts.key?(:channel)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
- `message_opts` is the hash you want to append to if you need to add an option.
|
|
91
|
+
- `options` is the hash containing the values when you call
|
|
92
|
+
`ExceptionNotification.notify_exception`
|
|
93
|
+
|
|
94
|
+
An example implementation would be:
|
|
95
|
+
```ruby
|
|
96
|
+
config.middleware.use ExceptionNotification::Rack,
|
|
97
|
+
slack: {
|
|
98
|
+
webhook_url: '[Your webhook url]',
|
|
99
|
+
pre_callback: proc { |opts, _notifier, _backtrace, _message, message_opts|
|
|
100
|
+
message_opts[:ping_option] = opts[:ping_option] if
|
|
101
|
+
opts.key?(:ping_option)
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
error_grouping: true
|
|
105
|
+
```
|
|
106
|
+
Then when calling from within your application code:
|
|
107
|
+
```ruby
|
|
108
|
+
ExceptionNotifier.notify_exception(
|
|
109
|
+
exception,
|
|
110
|
+
env: request.env,
|
|
111
|
+
ping_option: 'value',
|
|
112
|
+
# this will be passed to the slack notifier's `#ping`
|
|
113
|
+
# method, as a parameter. The `:pre_callback` hook will catch it
|
|
114
|
+
# and do that for you.
|
|
115
|
+
# Helpful, if the API evolves, you only need to update
|
|
116
|
+
# the `slack-notifier` gem
|
|
117
|
+
data: {
|
|
118
|
+
error: error_variable,
|
|
119
|
+
server: server_name
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
#### Options
|
|
125
|
+
|
|
126
|
+
##### webhook_url
|
|
127
|
+
|
|
128
|
+
*String, required*
|
|
129
|
+
|
|
130
|
+
The Incoming WebHook URL on slack.
|
|
131
|
+
|
|
132
|
+
##### channel
|
|
133
|
+
|
|
134
|
+
*String, optional*
|
|
135
|
+
|
|
136
|
+
Message will appear in this channel. Defaults to the channel you set as such on slack.
|
|
137
|
+
|
|
138
|
+
##### username
|
|
139
|
+
|
|
140
|
+
*String, optional*
|
|
141
|
+
|
|
142
|
+
Username of the bot. Defaults to the name you set as such on slack
|
|
143
|
+
|
|
144
|
+
##### custom_hook
|
|
145
|
+
|
|
146
|
+
*String, optional*
|
|
147
|
+
|
|
148
|
+
Custom hook name. See [slack-notifier](https://github.com/stevenosloan/slack-notifier#custom-hook-name) for
|
|
149
|
+
more information. Default: 'incoming-webhook'
|
|
150
|
+
|
|
151
|
+
##### additional_parameters
|
|
152
|
+
|
|
153
|
+
*Hash of strings, optional*
|
|
154
|
+
|
|
155
|
+
Contains additional payload for a message (e.g avatar, attachments, etc). See [slack-notifier](https://github.com/stevenosloan/slack-notifier#additional-parameters) for more information.. Default: '{}'
|
|
156
|
+
|
|
157
|
+
##### additional_fields
|
|
158
|
+
|
|
159
|
+
*Array of Hashes, optional*
|
|
160
|
+
|
|
161
|
+
Contains additional fields that will be added to the attachement. See [Slack documentation](https://api.slack.com/docs/message-attachments).
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
### Amazon SNS Notifier
|
|
2
|
+
|
|
3
|
+
Notify all exceptions Amazon - Simple Notification Service: [SNS](https://aws.amazon.com/sns/).
|
|
4
|
+
|
|
5
|
+
#### Usage
|
|
6
|
+
|
|
7
|
+
Add the [aws-sdk-sns](https://github.com/aws/aws-sdk-ruby/tree/master/gems/aws-sdk-sns) gem to your `Gemfile`:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'aws-sdk-sns', '~> 1.5'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
To configure it, you **need** to set 3 required options for aws: `region`, `access_key_id` and `secret_access_key`, and one more option for sns: `topic_arn`.
|
|
14
|
+
|
|
15
|
+
```ruby
|
|
16
|
+
Rails.application.config.middleware.use ExceptionNotification::Rack,
|
|
17
|
+
sns: {
|
|
18
|
+
region: 'us-east-x',
|
|
19
|
+
access_key_id: 'access_key_id',
|
|
20
|
+
secret_access_key: 'secret_access_key',
|
|
21
|
+
topic_arn: 'arn:aws:sns:us-east-x:XXXX:my-topic'
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
##### sns_prefix
|
|
26
|
+
*String, optional *
|
|
27
|
+
|
|
28
|
+
Prefix in the notification subject, by default: "[Error]"
|
|
29
|
+
|
|
30
|
+
##### backtrace_lines
|
|
31
|
+
*Integer, optional *
|
|
32
|
+
|
|
33
|
+
Number of backtrace lines to be displayed in the notification message. By default: 10
|
|
34
|
+
|
|
35
|
+
#### Note:
|
|
36
|
+
* You may need to update your previous `aws-sdk-*` gems in order to setup `aws-sdk-sns` correctly.
|
|
37
|
+
* If you need any further information about the available regions or any other SNS related topic consider: [SNS faqs](https://aws.amazon.com/sns/faqs/)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
### Teams notifier
|
|
2
|
+
|
|
3
|
+
Post notification in a Microsoft Teams channel via [Incoming Webhook Connector](https://docs.microsoft.com/en-us/outlook/actionable-messages/actionable-messages-via-connectors)
|
|
4
|
+
Just add the [HTTParty](https://github.com/jnunemaker/httparty) gem to your `Gemfile`:
|
|
5
|
+
|
|
6
|
+
```ruby
|
|
7
|
+
gem 'httparty'
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
To configure it, you **need** to set the `webhook_url` option.
|
|
11
|
+
If you are using GitLab for issue tracking, you can specify `git_url` as follows to add a *Create issue* button in your notification.
|
|
12
|
+
By default this will use your Rails application name to match the git repository. If yours differs, you can specify `app_name`.
|
|
13
|
+
By that same notion, you may also set a `jira_url` to get a button that will send you to the New Issue screen in Jira.
|
|
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
|
+
teams: {
|
|
23
|
+
webhook_url: 'https://outlook.office.com/webhook/your-guid/IncomingWebhook/team-guid',
|
|
24
|
+
git_url: 'https://your-gitlab.com/Group/Project',
|
|
25
|
+
jira_url: 'https://your-jira.com'
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### Options
|
|
30
|
+
|
|
31
|
+
##### webhook_url
|
|
32
|
+
|
|
33
|
+
*String, required*
|
|
34
|
+
|
|
35
|
+
The Incoming WebHook URL on Teams.
|
|
36
|
+
|
|
37
|
+
##### git_url
|
|
38
|
+
|
|
39
|
+
*String, optional*
|
|
40
|
+
|
|
41
|
+
Url of your gitlab or github with your organisation name for issue creation link (Eg: `github.com/aschen`). Defaults to nil and doesn't add link to the notification.
|
|
42
|
+
|
|
43
|
+
##### jira_url
|
|
44
|
+
|
|
45
|
+
*String, optional*
|
|
46
|
+
|
|
47
|
+
Url of your Jira instance, adds button for Create Issue screen. Defaults to nil and doesn't add a button to the card.
|
|
48
|
+
|
|
49
|
+
##### app_name
|
|
50
|
+
|
|
51
|
+
*String, optional*
|
|
52
|
+
|
|
53
|
+
Your application name used for git issue creation link. Defaults to `Rails.application.class.module_parent_name.underscore` for Rails versions >= 6;
|
|
54
|
+
`Rails.application.class.parent_name.underscore` otherwise.
|