Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v6.25.2 #775

Merged
merged 10 commits into from
Feb 7, 2023
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
Changelog
=========

## v6.25.2 (7 February 2023)

### Enhancements

* Improve performance of `Bugsnag.notify`
| [#774](https://github.com/bugsnag/bugsnag-ruby/pull/774)
| [sambostock](https://github.com/sambostock)

## v6.25.1 (5 January 2023)

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion Gemfile-maze-runner
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source "https://rubygems.org"

gem 'bugsnag-maze-runner', git: 'https://github.com/bugsnag/maze-runner', tag: 'v7.6.0'
gem 'bugsnag-maze-runner', git: 'https://github.com/bugsnag/maze-runner', tag: 'v7.10.1'
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.25.1
6.25.2
2 changes: 2 additions & 0 deletions features/fixtures/que/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ ENV QUE_VERSION $QUE_VERSION
RUN bundle install

COPY app/ /usr/src/app

CMD bundle exec que ./app.rb
13 changes: 13 additions & 0 deletions features/fixtures/rails_integrations/app/lib/tasks/fixture.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
namespace :fixture do
task queue_unhandled_job: [:environment] do
UnhandledJob.perform_later(1, yes: true)
end

task queue_working_job: [:environment] do
WorkingJob.perform_later
end

task queue_resque_job: [:environment] do
Resque.enqueue(ResqueWorker, 123, "abc", [7, 8, 9], x: true, y: false)
end
end
4 changes: 3 additions & 1 deletion features/fixtures/sidekiq/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ ENV SIDEKIQ_VERSION $SIDEKIQ_VERSION

RUN bundle install

COPY app/ /app/
COPY app/ /app/

CMD bundle exec sidekiq -r ./app.rb
8 changes: 4 additions & 4 deletions features/que.feature
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Feature: Errors are delivered to Bugsnag from Que

Scenario: Que will deliver unhandled errors
Given I run the service "que" with the command "bundle exec ruby app.rb unhandled"
And I run the service "que" with the command "timeout 5 bundle exec que ./app.rb"
Given I start the service "que"
When I execute the command "bundle exec ruby app.rb unhandled" in the service "que"
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
Expand All @@ -14,8 +14,8 @@ Scenario: Que will deliver unhandled errors
And the exception "errorClass" equals "RuntimeError"

Scenario: Que will deliver handled errors
Given I run the service "que" with the command "bundle exec ruby app.rb handled"
And I run the service "que" with the command "timeout 5 bundle exec que ./app.rb"
Given I start the service "que"
When I execute the command "bundle exec ruby app.rb handled" in the service "que"
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is false
Expand Down
86 changes: 50 additions & 36 deletions features/rails_features/integrations.feature
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
Feature: App type is set correctly for integrations in a Rails app

Background:
Given I start the rails service
And I run the "db:prepare" rake task in the rails app
And I run the "db:migrate" rake task in the rails app

@rails_integrations
Scenario: Delayed job
Given I start the rails service with the database
And I run the "jobs:work" rake task in the rails app in the background
When I run "User.new.delay.raise_the_roof" with the rails runner
And I run the "jobs:workoff" rake task in the rails app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
Expand All @@ -27,6 +23,7 @@ Scenario: Delayed job

@rails_integrations
Scenario: Mailman
Given I start the rails service
When I run "./run_mailman" in the rails app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
Expand All @@ -41,8 +38,9 @@ Scenario: Mailman

@rails_integrations
Scenario: Que
Given I start the rails service with the database
And I run "bundle exec que ./config/environment.rb" in the rails app in the background
When I run "QueJob.enqueue" with the rails runner
And I run "timeout 5 bundle exec que ./config/environment.rb" in the rails app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
Expand All @@ -56,6 +54,7 @@ Scenario: Que

@rails_integrations
Scenario: Rake
Given I start the rails service
When I run the "rake_task:raise" rake task in the rails app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
Expand All @@ -71,8 +70,9 @@ Scenario: Rake

@rails_integrations
Scenario: Resque (no on_exit hooks)
When I run "Resque.enqueue(ResqueWorker, 123, %(abc), x: true, y: false)" with the rails runner
And I run "timeout --signal QUIT 5 bundle exec rake resque:work" in the rails app
Given I start the rails service
And I run the "resque:work" rake task in the rails app in the background
When I run the "fixture:queue_resque_job" rake task in the rails app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
Expand All @@ -87,17 +87,21 @@ Scenario: Resque (no on_exit hooks)
And the event "metaData.payload.class" equals "ResqueWorker"
And the event "metaData.payload.args.0" equals 123
And the event "metaData.payload.args.1" equals "abc"
And the event "metaData.payload.args.2.x" is true
And the event "metaData.payload.args.2.y" is false
And the event "metaData.payload.args.2.0" equals 7
And the event "metaData.payload.args.2.1" equals 8
And the event "metaData.payload.args.2.2" equals 9
And the event "metaData.payload.args.3.x" is true
And the event "metaData.payload.args.3.y" is false
And the event "metaData.rake_task.name" equals "resque:work"
And the event "metaData.rake_task.description" equals "Start a Resque worker"
And the event "metaData.rake_task.arguments" is null

@rails_integrations
Scenario: Resque (with on_exit hooks)
Given I set environment variable "RUN_AT_EXIT_HOOKS" to "1"
When I run "Resque.enqueue(ResqueWorker, %(xyz), [7, 8, 9], a: 4, b: 5)" with the rails runner
And I run "timeout --signal QUIT 5 bundle exec rake resque:work" in the rails app
And I start the rails service
And I run the "resque:work" rake task in the rails app in the background
When I run the "fixture:queue_resque_job" rake task in the rails app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
Expand All @@ -110,20 +114,22 @@ Scenario: Resque (with on_exit hooks)
And the event "metaData.config.delivery_method" equals "thread_queue"
And the event "metaData.context" equals "ResqueWorker@crash"
And the event "metaData.payload.class" equals "ResqueWorker"
And the event "metaData.payload.args.0" equals "xyz"
And the event "metaData.payload.args.1.0" equals 7
And the event "metaData.payload.args.1.1" equals 8
And the event "metaData.payload.args.1.2" equals 9
And the event "metaData.payload.args.2.a" equals 4
And the event "metaData.payload.args.2.b" equals 5
And the event "metaData.payload.args.0" equals 123
And the event "metaData.payload.args.1" equals "abc"
And the event "metaData.payload.args.2.0" equals 7
And the event "metaData.payload.args.2.1" equals 8
And the event "metaData.payload.args.2.2" equals 9
And the event "metaData.payload.args.3.x" is true
And the event "metaData.payload.args.3.y" is false
And the event "metaData.rake_task.name" equals "resque:work"
And the event "metaData.rake_task.description" equals "Start a Resque worker"
And the event "metaData.rake_task.arguments" is null

@rails_integrations
Scenario: Sidekiq
Given I start the rails service
And I run "bundle exec sidekiq" in the rails app in the background
When I run "SidekiqWorker.perform_async" with the rails runner
And I run "timeout 5 bundle exec sidekiq" in the rails app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
Expand All @@ -140,8 +146,9 @@ Scenario: Sidekiq
@rails_integrations
Scenario: Using Sidekiq as the Active Job queue adapter for a job that raises
Given I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "sidekiq"
When I run "UnhandledJob.perform_later(1, yes: true)" with the rails runner
And I run "timeout 5 bundle exec sidekiq" in the rails app
And I start the rails service
And I run "bundle exec sidekiq" in the rails app in the background
When I run the "fixture:queue_unhandled_job" rake task in the rails app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
Expand All @@ -162,8 +169,9 @@ Scenario: Using Sidekiq as the Active Job queue adapter for a job that raises
@rails_integrations
Scenario: Using Resque as the Active Job queue adapter for a job that raises
Given I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "resque"
When I run "UnhandledJob.perform_later(1, yes: true)" with the rails runner
And I run "timeout --signal QUIT 5 bundle exec rake resque:work" in the rails app
And I start the rails service
And I run the "resque:work" rake task in the rails app in the background
When I run the "fixture:queue_unhandled_job" rake task in the rails app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
Expand All @@ -183,8 +191,9 @@ Scenario: Using Resque as the Active Job queue adapter for a job that raises
@rails_integrations
Scenario: Using Que as the Active Job queue adapter for a job that raises
Given I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "que"
When I run "UnhandledJob.perform_later(1, yes: true)" with the rails runner
And I run "timeout 5 bundle exec que -q default ./config/environment.rb" in the rails app
And I start the rails service with the database
And I run "bundle exec que -q default ./config/environment.rb" in the rails app in the background
When I run the "fixture:queue_unhandled_job" rake task in the rails app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
Expand All @@ -204,8 +213,9 @@ Scenario: Using Que as the Active Job queue adapter for a job that raises
@rails_integrations
Scenario: Using Delayed Job as the Active Job queue adapter for a job that raises
Given I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "delayed_job"
And I run "UnhandledJob.perform_later(1, yes: true)" with the rails runner
And I run the "jobs:workoff" rake task in the rails app
And I start the rails service with the database
And I run the "jobs:work" rake task in the rails app in the background
When I run the "fixture:queue_unhandled_job" rake task in the rails app
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
Expand All @@ -225,27 +235,31 @@ Scenario: Using Delayed Job as the Active Job queue adapter for a job that raise
@rails_integrations
Scenario: Using Sidekiq as the Active Job queue adapter for a job that works
Given I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "sidekiq"
And I run "WorkingJob.perform_later" with the rails runner
And I run "timeout 5 bundle exec sidekiq" in the rails app
And I start the rails service
And I run "bundle exec sidekiq" in the rails app in the background
When I run the "fixture:queue_working_job" rake task in the rails app
Then I should receive no requests

@rails_integrations
Scenario: Using Resque as the Active Job queue adapter for a job that works
Given I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "resque"
And I run "WorkingJob.perform_later" with the rails runner
And I run "timeout --signal QUIT 5 bundle exec rake resque:work" in the rails app
And I start the rails service
And I run "bundle exec rake resque:work" in the rails app in the background
When I run the "fixture:queue_working_job" rake task in the rails app
Then I should receive no requests

@rails_integrations
Scenario: Using Que as the Active Job queue adapter for a job that works
Given I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "que"
And I run "WorkingJob.perform_later" with the rails runner
And I run "timeout 5 bundle exec que -q default ./config/environment.rb" in the rails app
And I start the rails service with the database
And I run "bundle exec que -q default ./config/environment.rb" in the rails app in the background
When I run the "fixture:queue_working_job" rake task in the rails app
Then I should receive no requests

@rails_integrations
Scenario: Using Delayed Job as the Active Job queue adapter for a job that works
Given I set environment variable "ACTIVE_JOB_QUEUE_ADAPTER" to "delayed_job"
And I run "WorkingJob.perform_later" with the rails runner
And I run the "jobs:workoff" rake task in the rails app
And I start the rails service with the database
And I run the "jobs:work" rake task in the rails app in the background
When I run the "fixture:queue_working_job" rake task in the rails app
Then I should receive no requests
9 changes: 6 additions & 3 deletions features/sidekiq.feature
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
Feature: Bugsnag raises errors in Sidekiq workers

Scenario: An unhandled RuntimeError sends a report
Given I run the service "sidekiq" with the command "timeout 5 bundle exec rake sidekiq_tests:unhandled_error"
Given I start the service "sidekiq"
And I execute the command "bundle exec ruby initializers/UnhandledError.rb" in the service "sidekiq"
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is true
Expand All @@ -19,7 +20,8 @@ Scenario: An unhandled RuntimeError sends a report
And the event "metaData.config.delivery_method" equals "thread_queue"

Scenario: A handled RuntimeError can be notified
Given I run the service "sidekiq" with the command "timeout 5 bundle exec rake sidekiq_tests:handled_error"
Given I start the service "sidekiq"
And I execute the command "bundle exec ruby initializers/HandledError.rb" in the service "sidekiq"
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is false
Expand All @@ -35,7 +37,8 @@ Scenario: A handled RuntimeError can be notified

Scenario: Synchronous delivery can be used
Given I set environment variable "BUGSNAG_DELIVERY_METHOD" to "synchronous"
And I run the service "sidekiq" with the command "timeout 5 bundle exec rake sidekiq_tests:handled_error"
And I start the service "sidekiq"
And I execute the command "bundle exec ruby initializers/HandledError.rb" in the service "sidekiq"
And I wait to receive an error
Then the error is valid for the error reporting API version "4.0" for the "Ruby Bugsnag Notifier" notifier
And the event "unhandled" is false
Expand Down
24 changes: 22 additions & 2 deletions features/steps/ruby_notifier_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,27 @@
}
end

Given("I start the rails service with the database") do
steps %Q{
Given I start the rails service
And I run the "db:prepare" rake task in the rails app
And I run the "db:migrate" rake task in the rails app
}
end

When("I navigate to the route {string} on the rails app") do |route|
RAILS_FIXTURE.navigate_to(route)
end

When("I run {string} in the rails app") do |command|
steps %Q{
When I run the service "rails#{ENV['RAILS_VERSION']}" with the command "#{command}"
When I execute the command "#{command}" in the service "rails#{ENV['RAILS_VERSION']}"
}
end

When("I run {string} in the rails app in the background") do |command|
steps %Q{
When I execute the command "#{command}" in the service "rails#{ENV['RAILS_VERSION']}" in the background
}
end

Expand All @@ -43,9 +57,15 @@
}
end

When("I run the {string} rake task in the rails app in the background") do |task|
steps %Q{
When I run "bundle exec rake #{task}" in the rails app in the background
}
end

When("I run {string} with the rails runner") do |code|
steps %Q{
When I run "bundle exec rails runner '#{code}'" in the rails app
When I execute the command "bundle exec rails runner #{code}" in the service "rails#{ENV['RAILS_VERSION']}"
}
end

Expand Down
2 changes: 1 addition & 1 deletion lib/bugsnag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def configure(validate_api_key=true)
#
# Optionally accepts a block to append metadata to the yielded report.
def notify(exception, auto_notify=false, &block)
unless auto_notify.is_a? TrueClass or auto_notify.is_a? FalseClass
unless false.equal? auto_notify or true.equal? auto_notify
configuration.warn("Adding metadata/severity using a hash is no longer supported, please use block syntax instead")
auto_notify = false
end
Expand Down