-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #385 from bugsnag/kattrali/v6
Release v6.0.0
- Loading branch information
Showing
198 changed files
with
3,224 additions
and
2,518 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,38 @@ | ||
sudo: false | ||
language: ruby | ||
cache: bundler | ||
rvm: | ||
- 2.3.0 | ||
- 2.2.4 | ||
- 2.1.8 | ||
- 2.0.0 | ||
- 1.9.3 | ||
- jruby-19mode | ||
|
||
before_install: | ||
- gem install bundler -v 1.12 | ||
- gem update --system | ||
- bundle --version | ||
- gem update --system 2.6.14 | ||
- gem --version | ||
- gem install bundler -v 1.12 | ||
- bundle _1.12.0_ --version | ||
|
||
install: | ||
- bundle _1.12.0_ install --with "$GEMSETS" --binstubs | ||
|
||
script: | ||
- bundle exec ./bin/rake spec | ||
|
||
jobs: | ||
include: | ||
- stage: test | ||
env: GEMSETS=test | ||
rvm: jruby-19mode | ||
- stage: test | ||
env: GEMSETS=test | ||
rvm: 1.9.3 | ||
- stage: test | ||
env: GEMSETS=test | ||
rvm: 2.0.0 | ||
- stage: test | ||
env: GEMSETS=test | ||
rvm: 2.1.10 | ||
- stage: test | ||
env: GEMSETS="test sidekiq" | ||
rvm: 2.2.4 | ||
- stage: test | ||
env: GEMSETS="test sidekiq coverage" | ||
rvm: 2.3.0 | ||
- stage: test | ||
env: GEMSETS="test sidekiq" | ||
rvm: 2.4.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
source "https://rubygems.org" | ||
|
||
group :test, optional: true do | ||
gem 'rake', '~> 10.1.1' | ||
gem 'rspec' | ||
gem 'rdoc' | ||
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' | ||
end | ||
|
||
group :coverage, optional: true do | ||
gem 'simplecov' | ||
gem 'coveralls' | ||
end | ||
|
||
group :sidekiq, optional: true do | ||
gem 'sidekiq', '~> 5.0.4' | ||
end | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Upgrade Guide | ||
|
||
## 5.x to 6.x | ||
|
||
_Our Ruby library has gone through some major improvements and there are a few | ||
changes required to use the new integrations_ | ||
|
||
#### Capistrano and deploys | ||
|
||
Support for notifying Bugsnag of deployments has been separated into a separate | ||
gem named `bugsnag-capistrano`. See the [integration | ||
guide](https://docs.bugsnag.com/platforms/ruby/capistrano) for more information. | ||
|
||
|
||
#### Configuration | ||
|
||
* `Configuration.use_ssl` has been removed. Include the preferred protocol in `Configuration.endpoint` instead. | ||
```diff | ||
Bugsnag.configure do |config| | ||
- config.use_ssl = true | ||
- config.endpoint = 'myserver.example.com' | ||
+ config.endpoint = 'https://myserver.example.com' | ||
end | ||
``` | ||
* `Configuration.ignore_classes` now no longer accepts strings. Use classes directly instead. | ||
* `Configuration.delay_with_resque` has been removed | ||
* `Configuration.vendor_paths` has been removed | ||
* `Configuration.params_filters` has been renamed to `Configuration.meta_data_filters` to be clearer | ||
* `Configuration.proxy_host` will now default to `ENV['http_proxy']` if set. It can still be manually set. | ||
|
||
#### Notifying | ||
|
||
* `notify` now only supports block syntax. Replace usage of the overrides hash with a block | ||
|
||
```diff | ||
- Bugsnag.notify(e, {severity: 'info'}) | ||
+ Bugsnag.notify(e) do |report| | ||
+ report.severity = 'info' | ||
+ end | ||
``` | ||
|
||
* `Bugsnag.notify_or_ignore` and `Bugsnag.auto_notify` have been removed removed. Call `notify` directly instead. | ||
* `after_notify_callbacks` has been removed | ||
* `Bugsnag::Notification` has been renamed to `Bugsnag::Report` | ||
|
||
#### Logging | ||
|
||
* `config.debug` boolean has been removed. Set the logger level directly | ||
|
||
```diff | ||
+ require 'logger' | ||
|
||
Bugsnag.configure do |config| | ||
# .. set API key and other properties | ||
- config.debug = true | ||
+ config.logger.level = Logger::DEBUG | ||
end | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,44 @@ | ||
# Bugsnag Padrino demo | ||
|
||
This Padrino application demonstrates how to use Bugsnag with Padrino. Before | ||
testing it, open up the `config/boot.rb` file configure your API key inside | ||
`Padrino.before_load`. | ||
This Padrino application demonstrates how to use Bugsnag with Padrino. | ||
Further details about integrating Bugsnag with Rack applications can be found [here.](https://docs.bugsnag.com/platforms/ruby/rack/) | ||
|
||
``` | ||
Padrino.before_load do | ||
Bugsnag.configure do |config| | ||
config.api_key = '0a6f5add590596f93a8d601ea89af841' | ||
end | ||
end | ||
Install dependencies | ||
|
||
```shell | ||
bundle install | ||
``` | ||
|
||
In the same file activate the Bugsnag Rack middleware. | ||
## Configuring Bugsnag and Padrino | ||
|
||
``` | ||
Padrino.after_load do | ||
Padrino.use Bugsnag::Rack | ||
end | ||
``` | ||
1. Set up the Padrino Bugsnag configuration in ```config/boot.rb``` in the `before_load` call according to the [available configuration options](https://docs.bugsnag.com/platforms/ruby/rack/configuration-options/): | ||
```ruby | ||
Padrino.before_load do | ||
Bugsnag.configure do |config| | ||
config.api_key = 'YOUR_API_KEY' | ||
end | ||
end | ||
``` | ||
|
||
Open up `app/app.rb`, find two options and set them as follows: `raise_errors` | ||
to `true` and `show_exceptions` to `false`. This enables automatic notifications | ||
in the development environment. By default Padrino swallows exceptions from | ||
Bugsnag (only in development, though). | ||
2. Register the Rack middleware in ```config/boot.rb``` in the `after_load` call: | ||
```ruby | ||
Padrino.after_load do | ||
Padrino.use Bugsnag::Rack | ||
end | ||
``` | ||
|
||
``` | ||
3. In `production` automatic notification of exceptions and errors will be enabled by default. If you want to enable notifications in `development`, open ```app/app.rb``` and set the following options: | ||
```ruby | ||
set :raise_errors, true | ||
set :show_exceptions, false | ||
``` | ||
|
||
If you would like to use custom error handlers, then you need to notify Bugsnag | ||
explicitly. | ||
|
||
``` | ||
error 500 do | ||
Bugsnag.auto_notify($!) | ||
erb :'errors/500' | ||
end | ||
``` | ||
## Running the example | ||
|
||
Install dependencies. | ||
Run the example using: | ||
|
||
``` | ||
bundle install | ||
``` | ||
|
||
Launch the Padrino application. | ||
|
||
``` | ||
```shell | ||
bundle exec padrino start | ||
``` | ||
|
||
Next, open your project's dashboard on Bugsnag. | ||
|
||
1. [crash](http://localhost:9292/crash) | ||
<br/> | ||
Crashes the application and sends a notification about the nature of the crash. | ||
Basically, almost any unhandled exception sends a notification to Bugsnag. See | ||
the line mentioning `get '/crash'` in `app/app.rb`. | ||
|
||
1. [crash and use callbacks](http://localhost:9292/crash_with_callback) | ||
<br/> | ||
Before crashing, the application would append the Diagnostics tab with some | ||
predefined information, attached by means of a callback. See the line mentioning | ||
`get '/crash_with_callback'` in `app/app.rb`. | ||
|
||
1. [notify](http://localhost:9292/notify) | ||
<br/> | ||
Bugsnag Ruby provides a way to send notifications on demand by means of | ||
`Bugsnag.notify`. This API allows to send notifications manually, without | ||
crashing your application. See the line mentioning `get '/notify'` in | ||
`app/app.rb`. | ||
|
||
1. [notify with meta data](http://localhost:9292/notify_meta) | ||
<br/> | ||
Same as `notify`, but also attaches meta data. The meta data is any additional | ||
information you want to attach to an exception. In this artificial case | ||
additional information with be sent and displayed in a new tab called | ||
"Diagnostics". See the line mentioning `get '/notify_meta'` in `app/app.rb`. | ||
|
||
1. [severity](http://localhost:9292/severity) | ||
<br/> | ||
Bugsnag supports three severities: 'error', 'warning' and 'info'. You can set | ||
the severity by passing one of these objects as a string to '#notify'. See the | ||
line mentioning `get '/severity'` in `app/app.rb`. | ||
Once the server is running head to the default path for more information on Bugsnag logging examples. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,7 @@ class App < Padrino::Application | |
fenced_code_blocks: true | ||
} | ||
renderer = Redcarpet::Markdown.new(Redcarpet::Render::HTML, opts) | ||
renderer.render(File.read(File.expand_path('README.md'))) | ||
renderer.render(File.read(File.expand_path('app/templates/index.md'))) | ||
end | ||
|
||
get '/crash' do | ||
|
@@ -76,12 +76,12 @@ class App < Padrino::Application | |
end | ||
|
||
get '/crash_with_callback' do | ||
Bugsnag.before_notify_callbacks << proc { |notification| | ||
Bugsnag.before_notify_callbacks << proc { |report| | ||
new_tab = { | ||
message: 'Padrino demo says: Everything is great', | ||
code: 200 | ||
} | ||
notification.add_tab(:diagnostics, new_tab) | ||
report.add_tab(:diagnostics, new_tab) | ||
} | ||
|
||
msg = 'Bugsnag Padrino demo says: It crashed! But, due to the attached callback' + | ||
|
@@ -98,31 +98,31 @@ class App < Padrino::Application | |
' for a new notification.' | ||
end | ||
|
||
get '/notify_meta' do | ||
meta_data = { | ||
:user => { | ||
get '/notify_data' do | ||
error = RuntimeError.new("Bugsnag Padrino demo says: False alarm, your application didn't crash") | ||
Bugsnag.notify error do |report| | ||
report.add_tab(:user, { | ||
:username => "bob-hoskins", | ||
:email => '[email protected]', | ||
:registered_user => true | ||
}, | ||
|
||
:diagnostics => { | ||
}) | ||
report.add_tab(:diagnostics, { | ||
:message => 'Padrino demo says: Everything is great', | ||
:code => 200 | ||
} | ||
} | ||
error = RuntimeError.new("Bugsnag Padrino demo says: False alarm, your application didn't crash") | ||
Bugsnag.notify(error, meta_data) | ||
}) | ||
end | ||
|
||
"Bugsnag Padrino demo says: It didn't crash! " + | ||
'But still go check <a href="https://bugsnag.com">https://bugsnag.com</a>' + | ||
' for a new notification. Check out the User tab for the meta data' | ||
end | ||
|
||
get '/severity' do | ||
get '/notify_severity' do | ||
msg = "Bugsnag Padrino demo says: Look at the circle on the right side. It's different" | ||
error = RuntimeError.new(msg) | ||
Bugsnag.notify(error, severity: 'info') | ||
Bugsnag.notify error do |report| | ||
report.severity = 'info' | ||
end | ||
msg | ||
end | ||
end | ||
|
Oops, something went wrong.