bugsnag 6.10.0 → 6.11.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/.rubocop_todo.yml +4 -0
- data/CHANGELOG.md +20 -0
- data/Gemfile +1 -0
- data/README.md +1 -0
- data/VERSION +1 -1
- data/features/fixtures/docker-compose.yml +13 -0
- data/features/fixtures/rails3/app/app/controllers/breadcrumbs_controller.rb +19 -0
- data/features/fixtures/rails3/app/app/controllers/session_tracking_controller.rb +10 -6
- data/features/fixtures/rails3/app/config/initializers/bugsnag.rb +8 -2
- data/features/fixtures/rails3/app/config/routes.rb +1 -0
- data/features/fixtures/rails4/app/Gemfile +5 -1
- data/features/fixtures/rails4/app/app/controllers/breadcrumbs_controller.rb +26 -0
- data/features/fixtures/rails4/app/app/controllers/mongo_controller.rb +23 -0
- data/features/fixtures/rails4/app/app/controllers/session_tracking_controller.rb +9 -5
- data/features/fixtures/rails4/app/app/jobs/application_job.rb +2 -0
- data/features/fixtures/rails4/app/app/jobs/notify_job.rb +5 -0
- data/features/fixtures/rails4/app/app/models/mongo_model.rb +6 -0
- data/features/fixtures/rails4/app/config/initializers/bugsnag.rb +7 -1
- data/features/fixtures/rails4/app/config/mongoid.yml +22 -0
- data/features/fixtures/rails4/app/config/routes.rb +2 -0
- data/features/fixtures/rails5/app/Gemfile +4 -0
- data/features/fixtures/rails5/app/app/controllers/breadcrumbs_controller.rb +24 -0
- data/features/fixtures/rails5/app/app/controllers/mongo_controller.rb +22 -0
- data/features/fixtures/rails5/app/app/controllers/session_tracking_controller.rb +9 -5
- data/features/fixtures/rails5/app/app/jobs/notify_job.rb +5 -0
- data/features/fixtures/rails5/app/app/models/mongo_model.rb +6 -0
- data/features/fixtures/rails5/app/config/initializers/bugsnag.rb +7 -1
- data/features/fixtures/rails5/app/config/mongoid.yml +23 -0
- data/features/fixtures/rails5/app/config/routes.rb +11 -1
- data/features/rails_features/auto_capture_sessions.feature +55 -5
- data/features/rails_features/breadcrumbs.feature +135 -0
- data/features/rails_features/mongo_breadcrumbs.feature +100 -0
- data/features/steps/ruby_notifier_steps.rb +6 -0
- data/lib/bugsnag.rb +59 -3
- data/lib/bugsnag/breadcrumbs/breadcrumb.rb +76 -0
- data/lib/bugsnag/breadcrumbs/breadcrumbs.rb +14 -0
- data/lib/bugsnag/breadcrumbs/validator.rb +59 -0
- data/lib/bugsnag/configuration.rb +103 -6
- data/lib/bugsnag/integrations/mongo.rb +132 -0
- data/lib/bugsnag/integrations/rails/rails_breadcrumbs.rb +118 -0
- data/lib/bugsnag/integrations/railtie.rb +28 -1
- data/lib/bugsnag/middleware/breadcrumbs.rb +21 -0
- data/lib/bugsnag/report.rb +30 -1
- data/lib/bugsnag/session_tracker.rb +1 -0
- data/lib/bugsnag/utility/circular_buffer.rb +62 -0
- data/spec/breadcrumbs/breadcrumb_spec.rb +93 -0
- data/spec/breadcrumbs/validator_spec.rb +200 -0
- data/spec/bugsnag_spec.rb +230 -0
- data/spec/configuration_spec.rb +176 -2
- data/spec/integrations/mongo_spec.rb +262 -0
- data/spec/report_spec.rb +149 -0
- data/spec/session_tracker_spec.rb +24 -2
- data/spec/utility/circular_buffer_spec.rb +98 -0
- metadata +27 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc8a84dd1c666154aabc8e2a259f195e002b536d65c26c7e2a4399f988da37c0
|
4
|
+
data.tar.gz: c57acd7af26a27dcdc8649d8822f707f146f77d02fa01356941cf4cd4f9d8293
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1af419ae0b0fdc8b6284463a2945369564b5af5255aaeda4141f197787972d3483514a4db99e2a5dc9b6cba50ebd237bcdfe5509b738772954c25acdaa7582e
|
7
|
+
data.tar.gz: 845838f4f41b3893b95067437825c9af1ab4e634194d0cd81276784fde73e6227d1665da89c68d15e40181c257ec23eab7c857ff77225a9cfd52a7d1bbffb75d
|
data/.rubocop_todo.yml
CHANGED
@@ -289,6 +289,9 @@ Metrics/BlockNesting:
|
|
289
289
|
# Configuration parameters: CountComments.
|
290
290
|
Metrics/ClassLength:
|
291
291
|
Max: 149
|
292
|
+
Exclude:
|
293
|
+
- 'lib/bugsnag/report.rb'
|
294
|
+
- 'lib/bugsnag/configuration.rb'
|
292
295
|
|
293
296
|
# Offense count: 12
|
294
297
|
Metrics/CyclomaticComplexity:
|
@@ -305,6 +308,7 @@ Metrics/ModuleLength:
|
|
305
308
|
Max: 125
|
306
309
|
Exclude:
|
307
310
|
- 'lib/bugsnag/helpers.rb'
|
311
|
+
- 'lib/bugsnag.rb'
|
308
312
|
|
309
313
|
# Offense count: 11
|
310
314
|
Metrics/PerceivedComplexity:
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,26 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
## 6.11.0 (17 Jan 2019)
|
5
|
+
|
6
|
+
**Note**: this release alters the behaviour of the notifier to track sessions automatically.
|
7
|
+
|
8
|
+
### Enhancements
|
9
|
+
|
10
|
+
* Added Breadcrumbs. Breadcrumbs allow you to track events that may have led
|
11
|
+
up to an error, such as handled errors, page redirects, or SQL queries. For info on what
|
12
|
+
is tracked and how you can customize the data that breadcrumbs collect, see the
|
13
|
+
[Logging breadcrumbs](https://docs.bugsnag.com/platforms/ruby/other#logging-breadcrumbs)
|
14
|
+
section of our documentation.
|
15
|
+
| [#525](https://github.com/bugsnag/bugsnag-ruby/pull/525)
|
16
|
+
|
17
|
+
* Bugsnag will now capture automatically created sessions by default.
|
18
|
+
| [#523](https://github.com/bugsnag/bugsnag-ruby/pull/523)
|
19
|
+
|
20
|
+
### Deprecated
|
21
|
+
|
22
|
+
* The `endpoint` and `session_endpoint` configuration options are now deprecated but still supported. The [`set_endpoints`](https://docs.bugsnag.com/platforms/ruby/other/configuration-options#endpoints) method should be used instead. Note that session tracking will be disabled if the notify endpoint is configured but the sessions endpoint is not - this is to avoid inadvertently sending session payloads to the wrong server.
|
23
|
+
|
4
24
|
## 6.10.0 (05 Dec 2018)
|
5
25
|
|
6
26
|
### Enhancements
|
data/Gemfile
CHANGED
@@ -8,6 +8,7 @@ group :test, optional: true do
|
|
8
8
|
gem 'pry'
|
9
9
|
gem 'addressable', '~> 2.3.8'
|
10
10
|
gem 'delayed_job' if RUBY_VERSION >= '2.2.2'
|
11
|
+
gem 'i18n', RUBY_VERSION <= '2.3.0' ? '1.4.0': '>1.4.0' if RUBY_VERSION >= '2.2.2'
|
11
12
|
gem 'webmock', RUBY_VERSION <= '1.9.3' ? '2.3.2': '>2.3.2'
|
12
13
|
end
|
13
14
|
|
data/README.md
CHANGED
@@ -10,6 +10,7 @@ The Bugsnag exception reporter for Ruby gives you instant notification of except
|
|
10
10
|
* Report handled exceptions
|
11
11
|
* Attach user information to determine how many people are affected by a crash
|
12
12
|
* Send customized diagnostic data
|
13
|
+
* Track events that occur leading up to a crash
|
13
14
|
|
14
15
|
## Getting started
|
15
16
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
6.
|
1
|
+
6.11.0
|
@@ -4,6 +4,9 @@ services:
|
|
4
4
|
redis:
|
5
5
|
image: redis
|
6
6
|
|
7
|
+
mongo:
|
8
|
+
image: mongo
|
9
|
+
|
7
10
|
plain-ruby:
|
8
11
|
build:
|
9
12
|
context: plain
|
@@ -117,6 +120,8 @@ services:
|
|
117
120
|
- BUGSNAG_SESSION_ENDPOINT
|
118
121
|
- BUGSNAG_TIMEOUT
|
119
122
|
- CALLBACK_INITIATOR
|
123
|
+
- SQL_ONLY_BREADCRUMBS
|
124
|
+
- USE_DEFAULT_AUTO_CAPTURE_SESSIONS
|
120
125
|
ports:
|
121
126
|
- target: 3000
|
122
127
|
published: 61283
|
@@ -128,6 +133,8 @@ services:
|
|
128
133
|
args:
|
129
134
|
- RUBY_VERSION
|
130
135
|
- APP_PATH
|
136
|
+
depends_on:
|
137
|
+
- mongo
|
131
138
|
environment:
|
132
139
|
- BUGSNAG_API_KEY
|
133
140
|
- http_proxy
|
@@ -152,6 +159,8 @@ services:
|
|
152
159
|
- BUGSNAG_SESSION_ENDPOINT
|
153
160
|
- BUGSNAG_TIMEOUT
|
154
161
|
- CALLBACK_INITIATOR
|
162
|
+
- SQL_ONLY_BREADCRUMBS
|
163
|
+
- USE_DEFAULT_AUTO_CAPTURE_SESSIONS
|
155
164
|
ports:
|
156
165
|
- target: 3000
|
157
166
|
published: 61284
|
@@ -163,6 +172,8 @@ services:
|
|
163
172
|
args:
|
164
173
|
- RUBY_VERSION
|
165
174
|
- APP_PATH
|
175
|
+
depends_on:
|
176
|
+
- mongo
|
166
177
|
environment:
|
167
178
|
- BUGSNAG_API_KEY
|
168
179
|
- http_proxy
|
@@ -187,6 +198,8 @@ services:
|
|
187
198
|
- BUGSNAG_SESSION_ENDPOINT
|
188
199
|
- BUGSNAG_TIMEOUT
|
189
200
|
- CALLBACK_INITIATOR
|
201
|
+
- SQL_ONLY_BREADCRUMBS
|
202
|
+
- USE_DEFAULT_AUTO_CAPTURE_SESSIONS
|
190
203
|
ports:
|
191
204
|
- target: 3000
|
192
205
|
published: 61285
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class BreadcrumbsController < ApplicationController
|
2
|
+
def handled
|
3
|
+
Bugsnag.notify("Request breadcrumb")
|
4
|
+
render json: {}
|
5
|
+
end
|
6
|
+
|
7
|
+
def sql_breadcrumb
|
8
|
+
User.where(:email => "foo").as_json
|
9
|
+
Bugsnag.notify("SQL breadcrumb")
|
10
|
+
render json: {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def cache_read
|
14
|
+
Rails.cache.write('test', true)
|
15
|
+
Rails.cache.read('test')
|
16
|
+
Bugsnag.notify("Cache breadcrumb")
|
17
|
+
render json: {}
|
18
|
+
end
|
19
|
+
end
|
@@ -6,15 +6,19 @@ class SessionTrackingController < ActionController::Base
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def initializer
|
9
|
-
Bugsnag.session_tracker.send_sessions
|
9
|
+
Bugsnag.session_tracker.send_sessions
|
10
10
|
render json: {}
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
Bugsnag.
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
def manual
|
14
|
+
Bugsnag.start_session
|
15
|
+
Bugsnag.session_tracker.send_sessions
|
16
|
+
render json: {}
|
17
|
+
end
|
18
|
+
|
19
|
+
def multi_sessions
|
20
|
+
(0...100).each { Bugsnag.start_session }
|
21
|
+
Bugsnag.session_tracker.send_sessions
|
18
22
|
render json: {}
|
19
23
|
end
|
20
24
|
end
|
@@ -7,8 +7,14 @@ Bugsnag.configure do |config|
|
|
7
7
|
config.auto_notify = ENV["BUGSNAG_AUTO_NOTIFY"] != "false"
|
8
8
|
config.project_root = ENV["BUGSNAG_PROJECT_ROOT"] if ENV.include? "BUGSNAG_PROJECT_ROOT"
|
9
9
|
config.ignore_classes << lambda { |ex| ex.class.to_s == ENV["BUGSNAG_IGNORE_CLASS"] } if ENV.include? "BUGSNAG_IGNORE_CLASS"
|
10
|
-
config.auto_capture_sessions = ENV["BUGSNAG_AUTO_CAPTURE_SESSIONS"] == "true"
|
10
|
+
config.auto_capture_sessions = ENV["BUGSNAG_AUTO_CAPTURE_SESSIONS"] == "true" unless ENV["USE_DEFAULT_AUTO_CAPTURE_SESSIONS"]
|
11
11
|
config.release_stage = ENV["BUGSNAG_RELEASE_STAGE"] if ENV.include? "BUGSNAG_RELEASE_STAGE"
|
12
12
|
config.send_code = ENV["BUGSNAG_SEND_CODE"] != "false"
|
13
13
|
config.send_environment = ENV["BUGSNAG_SEND_ENVIRONMENT"] == "true"
|
14
|
-
|
14
|
+
|
15
|
+
if ENV["SQL_ONLY_BREADCRUMBS"] == "true"
|
16
|
+
config.before_breadcrumb_callbacks << Proc.new do |breadcrumb|
|
17
|
+
breadcrumb.ignore! unless breadcrumb.meta_data[:event_name] == "sql.active_record" && breadcrumb.meta_data[:name] == "User Load"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -14,5 +14,6 @@ App::Application.routes.draw do
|
|
14
14
|
get "/send_code/(:action)", controller: 'send_code'
|
15
15
|
get "/send_environment/(:action)", controller: 'send_environment'
|
16
16
|
get "/warden/(:action)", controller: 'warden'
|
17
|
+
get "/breadcrumbs/(:action)", controller: 'breadcrumbs'
|
17
18
|
get "/(:action)", controller: 'application'
|
18
19
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
class BreadcrumbsController < ApplicationController
|
2
|
+
def handled
|
3
|
+
Bugsnag.notify("Request breadcrumb")
|
4
|
+
render json: {}
|
5
|
+
end
|
6
|
+
|
7
|
+
def sql_breadcrumb
|
8
|
+
User.find_by(email: "foo")
|
9
|
+
Bugsnag.notify("SQL breadcrumb")
|
10
|
+
render json: {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def active_job
|
14
|
+
Thread.new { NotifyJob.perform_later }.join
|
15
|
+
render json: {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def cache_read
|
19
|
+
Thread.new {
|
20
|
+
Rails.cache.write('test', true)
|
21
|
+
Rails.cache.read('test')
|
22
|
+
Bugsnag.notify("Cache breadcrumb")
|
23
|
+
}.join
|
24
|
+
render json: {}
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class MongoController < ApplicationController
|
2
|
+
|
3
|
+
def success_crash
|
4
|
+
doc = MongoModel.create(string_field: "String")
|
5
|
+
doc.save
|
6
|
+
"Statement".prepnd("Failing")
|
7
|
+
end
|
8
|
+
|
9
|
+
def get_crash
|
10
|
+
MongoModel.where(string_field: true).as_json
|
11
|
+
MongoModel.any_of({string_field: true}, {numeric_field: 123}).as_json
|
12
|
+
"Statement".prepnd("Failing")
|
13
|
+
end
|
14
|
+
|
15
|
+
def failure_crash
|
16
|
+
begin
|
17
|
+
Mongoid::Clients.default.database.command(:bogus => 1)
|
18
|
+
rescue
|
19
|
+
end
|
20
|
+
|
21
|
+
"Statement".prepnd("Failing")
|
22
|
+
end
|
23
|
+
end
|
@@ -10,11 +10,15 @@ class SessionTrackingController < ActionController::Base
|
|
10
10
|
render json: {}
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
Bugsnag.
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
def manual
|
14
|
+
Bugsnag.start_session
|
15
|
+
Bugsnag.session_tracker.send_sessions
|
16
|
+
render json: {}
|
17
|
+
end
|
18
|
+
|
19
|
+
def multi_sessions
|
20
|
+
(0...100).each { Bugsnag.start_session }
|
21
|
+
Bugsnag.session_tracker.send_sessions
|
18
22
|
render json: {}
|
19
23
|
end
|
20
24
|
end
|
@@ -7,8 +7,14 @@ Bugsnag.configure do |config|
|
|
7
7
|
config.auto_notify = ENV["BUGSNAG_AUTO_NOTIFY"] != "false"
|
8
8
|
config.project_root = ENV["BUGSNAG_PROJECT_ROOT"] if ENV.include? "BUGSNAG_PROJECT_ROOT"
|
9
9
|
config.ignore_classes << lambda { |ex| ex.class.to_s == ENV["BUGSNAG_IGNORE_CLASS"] } if ENV.include? "BUGSNAG_IGNORE_CLASS"
|
10
|
-
config.auto_capture_sessions = ENV["BUGSNAG_AUTO_CAPTURE_SESSIONS"] == "true"
|
10
|
+
config.auto_capture_sessions = ENV["BUGSNAG_AUTO_CAPTURE_SESSIONS"] == "true" unless ENV["USE_DEFAULT_AUTO_CAPTURE_SESSIONS"]
|
11
11
|
config.release_stage = ENV["BUGSNAG_RELEASE_STAGE"] if ENV.include? "BUGSNAG_RELEASE_STAGE"
|
12
12
|
config.send_code = ENV["BUGSNAG_SEND_CODE"] != "false"
|
13
13
|
config.send_environment = ENV["BUGSNAG_SEND_ENVIRONMENT"] == "true"
|
14
|
+
|
15
|
+
if ENV["SQL_ONLY_BREADCRUMBS"] == "true"
|
16
|
+
config.before_breadcrumb_callbacks << Proc.new do |breadcrumb|
|
17
|
+
breadcrumb.ignore! unless breadcrumb.meta_data[:event_name] == "sql.active_record" && breadcrumb.meta_data[:name] == "User Load"
|
18
|
+
end
|
19
|
+
end
|
14
20
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
development:
|
2
|
+
# Configure available database clients. (required)
|
3
|
+
clients:
|
4
|
+
# Defines the default client. (required)
|
5
|
+
default:
|
6
|
+
# Defines the name of the default database that Mongoid can connect to.
|
7
|
+
# (required).
|
8
|
+
database: rails4_development
|
9
|
+
# Provides the hosts the default client can connect to. Must be an array
|
10
|
+
# of host:port pairs. (required)
|
11
|
+
hosts:
|
12
|
+
- mongo:27017
|
13
|
+
test:
|
14
|
+
clients:
|
15
|
+
default:
|
16
|
+
database: rails4_test
|
17
|
+
hosts:
|
18
|
+
- mongo:27017
|
19
|
+
options:
|
20
|
+
read:
|
21
|
+
mode: :primary
|
22
|
+
max_pool_size: 1
|
@@ -16,4 +16,6 @@ App::Application.routes.draw do
|
|
16
16
|
get "/send_code/(:action)", controller: 'send_code'
|
17
17
|
get "/send_environment/(:action)", controller: 'send_environment'
|
18
18
|
get "/devise/(:action)", controller: 'devise'
|
19
|
+
get "/breadcrumbs/(:action)", controller: 'breadcrumbs'
|
20
|
+
get "/mongo/(:action)", controller: 'mongo'
|
19
21
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class BreadcrumbsController < ApplicationController
|
2
|
+
def handled
|
3
|
+
Bugsnag.notify("Request breadcrumb")
|
4
|
+
render json: {}
|
5
|
+
end
|
6
|
+
|
7
|
+
def sql_breadcrumb
|
8
|
+
User.find_by(email: "foo")
|
9
|
+
Bugsnag.notify("SQL breadcrumb")
|
10
|
+
render json: {}
|
11
|
+
end
|
12
|
+
|
13
|
+
def active_job
|
14
|
+
NotifyJob.perform_later
|
15
|
+
render json: {}
|
16
|
+
end
|
17
|
+
|
18
|
+
def cache_read
|
19
|
+
Rails.cache.write('test', true)
|
20
|
+
Rails.cache.read('test')
|
21
|
+
Bugsnag.notify("Cache breadcrumb")
|
22
|
+
render json: {}
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class MongoController < ApplicationController
|
2
|
+
def success_crash
|
3
|
+
doc = MongoModel.create(string_field: "String")
|
4
|
+
doc.save
|
5
|
+
"Statement".prepnd("Failing")
|
6
|
+
end
|
7
|
+
|
8
|
+
def get_crash
|
9
|
+
MongoModel.where(string_field: true).as_json
|
10
|
+
MongoModel.any_of({string_field: true}, {numeric_field: 123}).as_json
|
11
|
+
"Statement".prepnd("Failing")
|
12
|
+
end
|
13
|
+
|
14
|
+
def failure_crash
|
15
|
+
begin
|
16
|
+
Mongoid::Clients.default.database.command(:bogus => 1)
|
17
|
+
rescue
|
18
|
+
end
|
19
|
+
|
20
|
+
"Statement".prepnd("Failing")
|
21
|
+
end
|
22
|
+
end
|
@@ -6,11 +6,15 @@ class SessionTrackingController < ActionController::Base
|
|
6
6
|
render json: {}
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
Bugsnag.
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
def manual
|
10
|
+
Bugsnag.start_session
|
11
|
+
Bugsnag.session_tracker.send_sessions
|
12
|
+
render json: {}
|
13
|
+
end
|
14
|
+
|
15
|
+
def multi_sessions
|
16
|
+
(0...100).each { Bugsnag.start_session }
|
17
|
+
Bugsnag.session_tracker.send_sessions
|
14
18
|
render json: {}
|
15
19
|
end
|
16
20
|
end
|