Skip to content

Commit

Permalink
Merge 2cd0138 into 33cfa31
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyhs committed Jun 11, 2019
2 parents 33cfa31 + 2cd0138 commit bd42096
Show file tree
Hide file tree
Showing 185 changed files with 10,693 additions and 135 deletions.
4 changes: 4 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@ Metrics/BlockNesting:
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 149
Exclude:
- 'lib/bugsnag/report.rb'
- 'lib/bugsnag/configuration.rb'

# Offense count: 12
Metrics/CyclomaticComplexity:
Expand All @@ -305,6 +308,7 @@ Metrics/ModuleLength:
Max: 125
Exclude:
- 'lib/bugsnag/helpers.rb'
- 'lib/bugsnag.rb'

# Offense count: 11
Metrics/PerceivedComplexity:
Expand Down
43 changes: 43 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,49 @@
Changelog
=========

## 6.11.1 (22 Jan 2019)

### Fixes

* Fix issue with unnecessary meta_data being logged during breadcrumb validation.
| [#530](https://github.com/bugsnag/bugsnag-ruby/pull/530)

## 6.11.0 (17 Jan 2019)

**Note**: this release alters the behaviour of the notifier to track sessions automatically.

### Enhancements

* Added Breadcrumbs. Breadcrumbs allow you to track events that may have led
up to an error, such as handled errors, page redirects, or SQL queries. For info on what
is tracked and how you can customize the data that breadcrumbs collect, see the
[Logging breadcrumbs](https://docs.bugsnag.com/platforms/ruby/other#logging-breadcrumbs)
section of our documentation.
| [#525](https://github.com/bugsnag/bugsnag-ruby/pull/525)

* Bugsnag will now capture automatically created sessions by default.
| [#523](https://github.com/bugsnag/bugsnag-ruby/pull/523)

### Deprecated

* 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.

## 6.10.0 (05 Dec 2018)

### Enhancements

* Add SignalException to our default ignored classes
| [#479](https://github.com/bugsnag/bugsnag-ruby/pull/479)
| [Toby Hsieh](https://github.com/tobyhs)

* Include Bugsnag frames, marked out of project
| [#497](https://github.com/bugsnag/bugsnag-ruby/pull/497)

### Fixes

* Ensure Sidekiq request data is always attached to notifications
| [#495](https://github.com/bugsnag/bugsnag-ruby/pull/495)

## 6.9.0 (12 Nov 2018)

### Enhancements
Expand Down
24 changes: 15 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
source "https://rubygems.org"

ruby_version = Gem::Version.new(RUBY_VERSION)

group :test, optional: true do
gem 'rake', RUBY_VERSION <= '1.9.3' ? '~> 11.3.0' : '~> 12.3.0'
gem 'rspec'
gem 'rspec-mocks'
gem 'rdoc', '~> 5.1.0'
gem 'pry'
gem 'addressable', '~> 2.3.8'
gem 'delayed_job' if RUBY_VERSION >= '2.2.2'
gem 'webmock', RUBY_VERSION <= '1.9.3' ? '2.3.2': '>2.3.2'
gem 'rake', ruby_version <= Gem::Version.new('1.9.3') ? '~> 11.3.0' : '~> 12.3.0'
gem 'rspec'
gem 'rspec-mocks'
gem 'rdoc', '~> 5.1.0'
gem 'pry'
gem 'addressable', '~> 2.3.8'
gem 'delayed_job' if ruby_version >= Gem::Version.new('2.2.2')
gem 'i18n', ruby_version <= Gem::Version.new('2.3.0') ? '1.4.0': '>1.4.0' if ruby_version >= Gem::Version.new('2.2.2')
gem 'webmock', ruby_version <= Gem::Version.new('1.9.3') ? '2.3.2': '>2.3.2'
gem 'hashdiff', ruby_version <= Gem::Version.new('1.9.3') ? '0.3.8': '>0.3.8'
end

group :coverage, optional: true do
Expand All @@ -22,14 +26,16 @@ end

group :sidekiq, optional: true do
gem 'sidekiq', '~> 5.0.4'
# redis 4.1.2 dropped support for Ruby 2.2
gem 'redis', ruby_version < Gem::Version.new('2.3.0') ? '4.1.1' : '>= 4.1.2'
end

group :doc, optional: true do
gem 'hanna-nouveau'
end

group :maze, optional: true do
gem 'bugsnag-maze-runner', git: 'https://github.com/bugsnag/maze-runner' if RUBY_VERSION >= '2.0.0'
gem 'bugsnag-maze-runner', git: 'https://github.com/bugsnag/maze-runner' if ruby_version >= Gem::Version.new('2.0.0')
end

gemspec
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The Bugsnag exception reporter for Ruby gives you instant notification of except
* Report handled exceptions
* Attach user information to determine how many people are affected by a crash
* Send customized diagnostic data
* Track events that occur leading up to a crash

## Getting started

Expand All @@ -33,7 +34,7 @@ The Bugsnag exception reporter for Ruby gives you instant notification of except
* [Rake](https://docs.bugsnag.com/platforms/ruby/rake/configuration-options)
* [Sidekiq](https://docs.bugsnag.com/platforms/ruby/sidekiq/configuration-options)
* [Other Ruby apps](https://docs.bugsnag.com/platforms/ruby/other/configuration-options)
* Check out some [example apps integrated with Bugsnag](https://github.com/bugsnag/bugsnag-example-apps/tree/master/apps/ruby) using Rails, Sinatra, Padrino, and more.
* Check out some [example apps integrated with Bugsnag](https://github.com/bugsnag/bugsnag-ruby/tree/master/example) using Rails, Sinatra, Padrino, and more.
* [Search open and closed issues](https://github.com/bugsnag/bugsnag-ruby/issues?utf8=✓&q=is%3Aissue) for similar problems
* [Report a bug or request a feature](https://github.com/bugsnag/bugsnag-ruby/issues/new)

Expand Down
22 changes: 22 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,25 @@ guide](https://docs.bugsnag.com/api/deploy-tracking/capistrano/) for more inform
+ Bugsnag.configuration.logger.warn "Warn message"
+ Bugsnag.configuration.logger.debug "Debug message"
```

#### Middleware

* If you previously accessed objects directly through `notification.exceptions`, this has now moved to `notification.raw_exceptions`

```diff
class ExampleMiddleware
def initialize(bugsnag)
@bugsnag = bugsnag
end

def call(report)
- exception = report.exceptions.first
+ exception = report.raw_exceptions.first
status = report.response.status

# do stuff

@bugsnag.call(report)
end
end
```
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.9.0
6.11.1
50 changes: 50 additions & 0 deletions features/fixtures/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ services:
redis:
image: redis

mongo:
image: mongo

plain-ruby:
build:
context: plain
Expand Down Expand Up @@ -117,6 +120,8 @@ services:
- BUGSNAG_SESSION_ENDPOINT
- BUGSNAG_TIMEOUT
- CALLBACK_INITIATOR
- SQL_ONLY_BREADCRUMBS
- USE_DEFAULT_AUTO_CAPTURE_SESSIONS
ports:
- target: 3000
published: 61283
Expand All @@ -128,6 +133,8 @@ services:
args:
- RUBY_VERSION
- APP_PATH
depends_on:
- mongo
environment:
- BUGSNAG_API_KEY
- http_proxy
Expand All @@ -152,6 +159,8 @@ services:
- BUGSNAG_SESSION_ENDPOINT
- BUGSNAG_TIMEOUT
- CALLBACK_INITIATOR
- SQL_ONLY_BREADCRUMBS
- USE_DEFAULT_AUTO_CAPTURE_SESSIONS
ports:
- target: 3000
published: 61284
Expand All @@ -163,6 +172,8 @@ services:
args:
- RUBY_VERSION
- APP_PATH
depends_on:
- mongo
environment:
- BUGSNAG_API_KEY
- http_proxy
Expand All @@ -187,11 +198,50 @@ services:
- BUGSNAG_SESSION_ENDPOINT
- BUGSNAG_TIMEOUT
- CALLBACK_INITIATOR
- SQL_ONLY_BREADCRUMBS
- USE_DEFAULT_AUTO_CAPTURE_SESSIONS
ports:
- target: 3000
published: 61285
restart: "no"

rails6:
build:
context: rails6
args:
- RUBY_VERSION
- APP_PATH
environment:
- BUGSNAG_API_KEY
- http_proxy
- RAILS_ENV
- BUGSNAG_APP_TYPE
- BUGSNAG_APP_VERSION
- BUGSNAG_AUTO_CAPTURE_SESSIONS
- BUGSNAG_AUTO_NOTIFY
- BUGSNAG_ENDPOINT
- BUGSNAG_IGNORE_CLASS
- BUGSNAG_IGNORE_MESSAGE
- BUGSNAG_META_DATA_FILTERS
- BUGSNAG_NOTIFY_RELEASE_STAGE
- BUGSNAG_PROJECT_ROOT
- BUGSNAG_PROXY_HOST
- BUGSNAG_PROXY_PASSWORD
- BUGSNAG_PROXY_PORT
- BUGSNAG_PROXY_USER
- BUGSNAG_RELEASE_STAGE
- BUGSNAG_SEND_CODE
- BUGSNAG_SEND_ENVIRONMENT
- BUGSNAG_SESSION_ENDPOINT
- BUGSNAG_TIMEOUT
- CALLBACK_INITIATOR
- SQL_ONLY_BREADCRUMBS
- USE_DEFAULT_AUTO_CAPTURE_SESSIONS
ports:
- target: 3000
published: 61286
restart: "no"

resque:
build:
context: resque
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ def step_three
end

def crash
Bugsnag.notify(RuntimeError.new("oh no"))
begin
"Test".insrt(-1, "!")
rescue Exception => e
Bugsnag.notify(e)
end
end
2 changes: 1 addition & 1 deletion features/fixtures/rails3/app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ gem 'rails', '3.2.22.5'

gem 'nokogiri', '1.6.8'

gem 'sqlite3'
gem 'sqlite3', '< 1.4'

gem 'jquery-rails'

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class BreadcrumbsController < ApplicationController
def handled
Bugsnag.notify("Request breadcrumb")
render json: {}
end

def sql_breadcrumb
User.where(:email => "foo").as_json
Bugsnag.notify("SQL breadcrumb")
render json: {}
end

def cache_read
Rails.cache.write('test', true)
Rails.cache.read('test')
Bugsnag.notify("Cache breadcrumb")
render json: {}
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@ def index
end

def initializer
Bugsnag.session_tracker.send_sessions()
Bugsnag.session_tracker.send_sessions
render json: {}
end

def after
Bugsnag.configure do |conf|
conf.auto_capture_sessions = true
end
Bugsnag.session_tracker.send_sessions()
def manual
Bugsnag.start_session
Bugsnag.session_tracker.send_sessions
render json: {}
end

def multi_sessions
(0...100).each { Bugsnag.start_session }
Bugsnag.session_tracker.send_sessions
render json: {}
end
end
10 changes: 8 additions & 2 deletions features/fixtures/rails3/app/config/initializers/bugsnag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@
config.auto_notify = ENV["BUGSNAG_AUTO_NOTIFY"] != "false"
config.project_root = ENV["BUGSNAG_PROJECT_ROOT"] if ENV.include? "BUGSNAG_PROJECT_ROOT"
config.ignore_classes << lambda { |ex| ex.class.to_s == ENV["BUGSNAG_IGNORE_CLASS"] } if ENV.include? "BUGSNAG_IGNORE_CLASS"
config.auto_capture_sessions = ENV["BUGSNAG_AUTO_CAPTURE_SESSIONS"] == "true"
config.auto_capture_sessions = ENV["BUGSNAG_AUTO_CAPTURE_SESSIONS"] == "true" unless ENV["USE_DEFAULT_AUTO_CAPTURE_SESSIONS"]
config.release_stage = ENV["BUGSNAG_RELEASE_STAGE"] if ENV.include? "BUGSNAG_RELEASE_STAGE"
config.send_code = ENV["BUGSNAG_SEND_CODE"] != "false"
config.send_environment = ENV["BUGSNAG_SEND_ENVIRONMENT"] == "true"
end

if ENV["SQL_ONLY_BREADCRUMBS"] == "true"
config.before_breadcrumb_callbacks << Proc.new do |breadcrumb|
breadcrumb.ignore! unless breadcrumb.meta_data[:event_name] == "sql.active_record" && breadcrumb.meta_data[:name] == "User Load"
end
end
end
1 change: 1 addition & 0 deletions features/fixtures/rails3/app/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
get "/send_code/(:action)", controller: 'send_code'
get "/send_environment/(:action)", controller: 'send_environment'
get "/warden/(:action)", controller: 'warden'
get "/breadcrumbs/(:action)", controller: 'breadcrumbs'
get "/(:action)", controller: 'application'
end
8 changes: 6 additions & 2 deletions features/fixtures/rails4/app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source 'https://rubygems.org'
gem 'rails', '~>4'

# Use sqlite3 as the database for Active Record
gem 'sqlite3'
gem 'sqlite3', '< 1.4'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
Expand Down Expand Up @@ -39,4 +39,8 @@ end
# Added at 2018-03-26 15:02:53 +0100 by amoinet:
gem 'bugsnag', path: '/bugsnag'

gem 'devise'
gem 'devise'

gem "mongoid", '~> 5.4.0'

gem "nokogiri", "1.6.8"
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class BreadcrumbsController < ApplicationController
def handled
Bugsnag.notify("Request breadcrumb")
render json: {}
end

def sql_breadcrumb
User.find_by(email: "foo")
Bugsnag.notify("SQL breadcrumb")
render json: {}
end

def active_job
Thread.new { NotifyJob.perform_later }.join
render json: {}
end

def cache_read
Thread.new {
Rails.cache.write('test', true)
Rails.cache.read('test')
Bugsnag.notify("Cache breadcrumb")
}.join
render json: {}
end
end
Loading

0 comments on commit bd42096

Please sign in to comment.