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

Setup Airbrake for your Ruby application #27

Open
Aboubacar24 opened this issue Jun 15, 2022 · 0 comments
Open

Setup Airbrake for your Ruby application #27

Aboubacar24 opened this issue Jun 15, 2022 · 0 comments
Labels

Comments

@Aboubacar24
Copy link

Installing with the CLI

The Airbrake CLI installs the Airbrake Ruby notifier automatically in your Ruby project. To install the gem directly without using the CLI, please scroll down to the Installing manually section.

Install the CLI via Homebrew

brew install airbrake/airbrake-cli/airbrake

Authenticate via config command

Authenticate by setting your user-key with the config command:

airbrake config set user-key YOUR_USER_KEY_HERE

You can find your user key in your profile settings page.

Install command

Invoke the following to have the Airbrake CLI install the Airbrake notifier for your project:

airbrake install --project-id YOUR_PROJECT_ID_HERE

You can find your project ID in your project's settings.

After this, you are set! Check out the Testing your installation section to send a test error to Airbrake.

Installing manually

Option 1: Bundler

Add the Airbrake Ruby gem to your Gemfile:

gem 'airbrake-ruby'

Option 2: Manual

Invoke the following command from your terminal:

gem install airbrake-ruby

Configuration

Just require the library and copy this configuration snippet into your Ruby project:

(You can find your project ID and API key in your project's settings)

require 'airbrake-ruby'

Airbrake.configure do |c|
  c.project_id = <Your project ID>
  c.project_key = '<Your project API KEY>'
end

Testing your installation

To test your installation, send a test error to Airbrake as shown in the example below. Uncaught errors are automatically sent to Airbrake. Caught errors can be sent to Airbrake using the notify method:

begin
  1/0
rescue ZeroDivisionError => ex
  Airbrake.notify(ex)
end

Full documentation

For in depth examples and advanced configuration options like error filtering or custom parameters, please visit our official GitHub repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant