tensorbuzz-api for Ruby
Ruby, Rack, Rails, and Sidekiq error reporting for TensorBuzz.
Installation
gem "tensorbuzz-api"
Configuration
require "tensorbuzz/api"
TensorBuzz::BugReporting.configure do |config|
config.auth_token = ENV.fetch("TENSORBUZZ_BUG_REPORT_AUTH_TOKEN")
config.project_id = ENV.fetch("TENSORBUZZ_BUG_REPORT_PROJECT_ID")
config.hostname = ENV["TENSORBUZZ_BUG_REPORT_HOSTNAME"]
config.environment = ENV.fetch("RAILS_ENV", "production")
config.release = ENV["APP_RELEASE"]
config.logger = Rails.logger
end
The default endpoint is https://server.tensorbuzz.com/errors/reports. Set
config.post_url when using another TensorBuzz installation.
Reporting
TensorBuzz::BugReporting.report(error, parameters: {order_id: order.id})
TensorBuzz::BugReporting.("Payment session creation failed")
TensorBuzz::BugReporting.with_parameters(user_id: user.id) do
perform_work
end
Scoped parameters are attached to exceptions that leave the block, allowing a later Rails or Sidekiq handler to report the original context.
Rails and Sidekiq
require "tensorbuzz/api/rails"
require "tensorbuzz/api/sidekiq"
TensorBuzz::Api::Rails.configure
TensorBuzz::Api::Sidekiq.configure
The Rack middleware reports uncaught request errors and re-raises the original exception. The Sidekiq integration uses Sidekiq's error-handler API. Reporting failures are logged and never replace the application exception.