Ruby SDK
Error tracking SDK for Ruby and Rails applications.
Ruby 2.7+
Rails 6+
Installation
Add to your Gemfile:
gem 'alertiqo'
Then run:
bundle install
Or install directly:
gem install alertiqo
Basic Setup
require 'alertiqo'
Alertiqo.configure do |config|
config.api_key = 'your-api-key'
config.endpoint = 'https://alertiqo.io'
config.environment = 'production'
config.release = '1.0.0'
end
Alertiqo.init
Rails Setup
Create an initializer config/initializers/alertiqo.rb:
Alertiqo.configure do |config|
config.api_key = ENV['ALERTIQO_API_KEY']
config.endpoint = ENV['ALERTIQO_ENDPOINT'] || 'https://alertiqo.io'
config.environment = Rails.env
config.release = ENV['APP_VERSION']
end
Add to your application.rb:
require 'alertiqo/rails'
Usage
Capture Exceptions
begin
some_risky_operation
rescue => e
Alertiqo.capture_exception(e)
end
Capture Messages
Alertiqo.capture_message("User completed checkout", level: "info")
Add Breadcrumbs
Alertiqo.add_breadcrumb(
"User clicked button",
category: "user-action",
level: "info",
data: { button_id: "submit-btn" }
)
Set User Context
Alertiqo.set_user(
id: "12345",
email: "[email protected]",
username: "johndoe"
)
Set Tags
Alertiqo.set_tag("page", "checkout")
Alertiqo.set_tags({
feature: "payments",
version: "2.1.0"
})
Configuration Options
Alertiqo.configure do |config|
# Required
config.api_key = 'your-api-key'
config.endpoint = 'https://alertiqo.io'
# Optional
config.environment = 'production' # Default: RACK_ENV or RAILS_ENV
config.release = '1.0.0' # App version
config.tags = { app: 'myapp' } # Default tags
config.enabled = true # Enable/disable tracking
config.capture_unhandled = true # Auto-capture unhandled exceptions
# Filter/modify errors before sending
config.before_send = ->(report) {
# Return nil to skip sending
# Return modified report to send
report
}
end
Environment Variables
ALERTIQO_API_KEY=your-api-key
ALERTIQO_ENDPOINT=https://alertiqo.io
API Reference
| Method | Description |
|---|---|
Alertiqo.init |
Initialize error handlers |
Alertiqo.capture_exception(e) |
Capture an exception |
Alertiqo.capture_message(msg, level:) |
Capture a message |
Alertiqo.add_breadcrumb(msg, opts) |
Add a breadcrumb |
Alertiqo.set_user(opts) |
Set user context |
Alertiqo.set_tag(key, value) |
Set a single tag |
Alertiqo.set_tags(tags) |
Set multiple tags |