exception_notification 4.3.0 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (131) hide show
  1. checksums.yaml +5 -5
  2. data/Appraisals +4 -2
  3. data/CHANGELOG.rdoc +47 -0
  4. data/CONTRIBUTING.md +18 -0
  5. data/Gemfile +3 -1
  6. data/README.md +97 -945
  7. data/Rakefile +4 -2
  8. data/docs/notifiers/campfire.md +50 -0
  9. data/docs/notifiers/custom.md +42 -0
  10. data/docs/notifiers/datadog.md +51 -0
  11. data/docs/notifiers/email.md +195 -0
  12. data/docs/notifiers/google_chat.md +31 -0
  13. data/docs/notifiers/hipchat.md +66 -0
  14. data/docs/notifiers/irc.md +97 -0
  15. data/docs/notifiers/mattermost.md +115 -0
  16. data/docs/notifiers/slack.md +161 -0
  17. data/docs/notifiers/sns.md +37 -0
  18. data/docs/notifiers/teams.md +54 -0
  19. data/docs/notifiers/webhook.md +60 -0
  20. data/examples/sample_app.rb +56 -0
  21. data/examples/sinatra/Gemfile +8 -6
  22. data/examples/sinatra/config.ru +3 -1
  23. data/examples/sinatra/sinatra_app.rb +19 -11
  24. data/exception_notification.gemspec +30 -24
  25. data/gemfiles/{rails4_0.gemfile → rails5_2.gemfile} +2 -2
  26. data/gemfiles/{rails4_1.gemfile → rails6_0.gemfile} +2 -2
  27. data/gemfiles/{rails4_2.gemfile → rails6_1.gemfile} +2 -2
  28. data/gemfiles/{rails5_0.gemfile → rails7_0.gemfile} +2 -2
  29. data/lib/exception_notification/rack.rb +28 -30
  30. data/lib/exception_notification/rails.rb +2 -0
  31. data/lib/exception_notification/resque.rb +10 -10
  32. data/lib/exception_notification/sidekiq.rb +10 -12
  33. data/lib/exception_notification/version.rb +5 -0
  34. data/lib/exception_notification.rb +3 -0
  35. data/lib/exception_notifier/base_notifier.rb +10 -5
  36. data/lib/exception_notifier/datadog_notifier.rb +156 -0
  37. data/lib/exception_notifier/email_notifier.rb +73 -88
  38. data/lib/exception_notifier/google_chat_notifier.rb +27 -119
  39. data/lib/exception_notifier/hipchat_notifier.rb +13 -12
  40. data/lib/exception_notifier/irc_notifier.rb +36 -33
  41. data/lib/exception_notifier/mattermost_notifier.rb +54 -137
  42. data/lib/exception_notifier/modules/backtrace_cleaner.rb +2 -2
  43. data/lib/exception_notifier/modules/error_grouping.rb +24 -13
  44. data/lib/exception_notifier/modules/formatter.rb +125 -0
  45. data/lib/exception_notifier/notifier.rb +9 -6
  46. data/lib/exception_notifier/slack_notifier.rb +65 -40
  47. data/lib/exception_notifier/sns_notifier.rb +23 -13
  48. data/lib/exception_notifier/teams_notifier.rb +67 -46
  49. data/lib/exception_notifier/views/exception_notifier/_backtrace.html.erb +1 -1
  50. data/lib/exception_notifier/views/exception_notifier/_environment.text.erb +1 -1
  51. data/lib/exception_notifier/views/exception_notifier/_request.text.erb +1 -1
  52. data/lib/exception_notifier/views/exception_notifier/exception_notification.html.erb +2 -2
  53. data/lib/exception_notifier/views/exception_notifier/exception_notification.text.erb +2 -2
  54. data/lib/exception_notifier/webhook_notifier.rb +17 -14
  55. data/lib/exception_notifier.rb +65 -10
  56. data/lib/generators/exception_notification/install_generator.rb +11 -5
  57. data/lib/generators/exception_notification/templates/{exception_notification.rb → exception_notification.rb.erb} +13 -11
  58. data/test/exception_notification/rack_test.rb +75 -13
  59. data/test/exception_notification/resque_test.rb +54 -0
  60. data/test/exception_notifier/datadog_notifier_test.rb +153 -0
  61. data/test/exception_notifier/email_notifier_test.rb +275 -153
  62. data/test/exception_notifier/google_chat_notifier_test.rb +158 -101
  63. data/test/exception_notifier/hipchat_notifier_test.rb +84 -81
  64. data/test/exception_notifier/irc_notifier_test.rb +36 -34
  65. data/test/exception_notifier/mattermost_notifier_test.rb +213 -67
  66. data/test/exception_notifier/modules/error_grouping_test.rb +41 -40
  67. data/test/exception_notifier/modules/formatter_test.rb +152 -0
  68. data/test/exception_notifier/sidekiq_test.rb +9 -17
  69. data/test/exception_notifier/slack_notifier_test.rb +66 -63
  70. data/test/exception_notifier/sns_notifier_test.rb +84 -32
  71. data/test/exception_notifier/teams_notifier_test.rb +25 -26
  72. data/test/exception_notifier/webhook_notifier_test.rb +52 -48
  73. data/test/exception_notifier_test.rb +150 -41
  74. data/test/support/exception_notifier_helper.rb +14 -0
  75. data/test/{dummy/app → support}/views/exception_notifier/_new_bkg_section.html.erb +0 -0
  76. data/test/{dummy/app → support}/views/exception_notifier/_new_bkg_section.text.erb +0 -0
  77. data/test/{dummy/app → support}/views/exception_notifier/_new_section.html.erb +0 -0
  78. data/test/{dummy/app → support}/views/exception_notifier/_new_section.text.erb +0 -0
  79. data/test/test_helper.rb +14 -13
  80. metadata +134 -175
  81. data/gemfiles/rails5_1.gemfile +0 -7
  82. data/lib/exception_notifier/campfire_notifier.rb +0 -40
  83. data/test/dummy/.gitignore +0 -4
  84. data/test/dummy/Rakefile +0 -7
  85. data/test/dummy/app/controllers/application_controller.rb +0 -3
  86. data/test/dummy/app/controllers/posts_controller.rb +0 -30
  87. data/test/dummy/app/helpers/application_helper.rb +0 -2
  88. data/test/dummy/app/helpers/posts_helper.rb +0 -2
  89. data/test/dummy/app/models/post.rb +0 -2
  90. data/test/dummy/app/views/layouts/application.html.erb +0 -14
  91. data/test/dummy/app/views/posts/_form.html.erb +0 -0
  92. data/test/dummy/app/views/posts/new.html.erb +0 -0
  93. data/test/dummy/app/views/posts/show.html.erb +0 -0
  94. data/test/dummy/config/application.rb +0 -42
  95. data/test/dummy/config/boot.rb +0 -6
  96. data/test/dummy/config/database.yml +0 -22
  97. data/test/dummy/config/environment.rb +0 -17
  98. data/test/dummy/config/environments/development.rb +0 -25
  99. data/test/dummy/config/environments/production.rb +0 -50
  100. data/test/dummy/config/environments/test.rb +0 -35
  101. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  102. data/test/dummy/config/initializers/inflections.rb +0 -10
  103. data/test/dummy/config/initializers/mime_types.rb +0 -5
  104. data/test/dummy/config/initializers/secret_token.rb +0 -8
  105. data/test/dummy/config/initializers/session_store.rb +0 -8
  106. data/test/dummy/config/locales/en.yml +0 -5
  107. data/test/dummy/config/routes.rb +0 -3
  108. data/test/dummy/config.ru +0 -4
  109. data/test/dummy/db/migrate/20110729022608_create_posts.rb +0 -15
  110. data/test/dummy/db/schema.rb +0 -24
  111. data/test/dummy/db/seeds.rb +0 -7
  112. data/test/dummy/lib/tasks/.gitkeep +0 -0
  113. data/test/dummy/public/404.html +0 -26
  114. data/test/dummy/public/422.html +0 -26
  115. data/test/dummy/public/500.html +0 -26
  116. data/test/dummy/public/favicon.ico +0 -0
  117. data/test/dummy/public/images/rails.png +0 -0
  118. data/test/dummy/public/index.html +0 -239
  119. data/test/dummy/public/javascripts/application.js +0 -2
  120. data/test/dummy/public/javascripts/controls.js +0 -965
  121. data/test/dummy/public/javascripts/dragdrop.js +0 -974
  122. data/test/dummy/public/javascripts/effects.js +0 -1123
  123. data/test/dummy/public/javascripts/prototype.js +0 -6001
  124. data/test/dummy/public/javascripts/rails.js +0 -191
  125. data/test/dummy/public/robots.txt +0 -5
  126. data/test/dummy/public/stylesheets/.gitkeep +0 -0
  127. data/test/dummy/public/stylesheets/scaffold.css +0 -56
  128. data/test/dummy/script/rails +0 -6
  129. data/test/dummy/test/functional/posts_controller_test.rb +0 -237
  130. data/test/dummy/test/test_helper.rb +0 -7
  131. data/test/exception_notifier/campfire_notifier_test.rb +0 -120
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 :default => [:test]
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.verbose = true
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).
@@ -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.