### Install Dependencies with Bundler Source: https://github.com/getsentry/sentry-ruby/blob/master/CLAUDE.md Navigate to the gem's directory and run `bundle install` to install its dependencies. ```bash cd sentry-ruby && bundle install ``` -------------------------------- ### Install Sentry Ruby Integrations Source: https://github.com/getsentry/sentry-ruby/blob/master/README.md Install additional gems for specific framework and library integrations with Sentry. ```ruby gem "sentry-rails" gem "sentry-sidekiq" gem "sentry-delayed_job" gem "sentry-resque" gem "sentry-opentelemetry" gem "sentry-yabeda" ``` -------------------------------- ### Install Sentry and OpenTelemetry Gems Source: https://github.com/getsentry/sentry-ruby/blob/master/sentry-opentelemetry/README.md Add these gems to your Gemfile to include Sentry and OpenTelemetry functionalities. Ensure you also include the necessary OpenTelemetry instrumentation. ```ruby gem "sentry-ruby" gem "sentry-rails" gem "sentry-opentelemetry" gem "opentelemetry-sdk" gem "opentelemetry-instrumentation-all" ``` -------------------------------- ### Create Devcontainer Environment File Source: https://github.com/getsentry/sentry-ruby/blob/master/CONTRIBUTING.md Copy the example .env file to create a new one for the devcontainer configuration. This file defines the Docker image and Ruby version to be used. ```bash cp .devcontainer/.env.example .devcontainer/.env ``` -------------------------------- ### Install Gem Dependencies Source: https://github.com/getsentry/sentry-ruby/blob/master/CONTRIBUTING.md Install dependencies for a specific gem within the sentry-ruby project. Ensure you are in the gem's subdirectory before running this command. ```bash cd sentry-sidekiq bundle install ``` -------------------------------- ### Install Sentry Ruby Gem Source: https://github.com/getsentry/sentry-ruby/blob/master/README.md Add the main Sentry Ruby gem to your project's Gemfile. ```ruby gem "sentry-ruby" ``` -------------------------------- ### Install sentry-ruby and sentry-yabeda Gems Source: https://github.com/getsentry/sentry-ruby/blob/master/sentry-yabeda/README.md Add these lines to your Gemfile to include the Sentry Ruby client and the Yabeda integration. ```ruby gem "sentry-ruby" gem "sentry-yabeda" ``` -------------------------------- ### Install sentry-ruby and sentry-sidekiq Gems Source: https://github.com/getsentry/sentry-ruby/blob/master/sentry-sidekiq/README.md Add these gems to your Gemfile to enable Sentry error tracking for Sidekiq. The gem automatically includes necessary middleware. ```ruby gem "sentry-ruby" gem "sentry-sidekiq" ``` -------------------------------- ### Install sentry-ruby and sentry-resque Gems Source: https://github.com/getsentry/sentry-ruby/blob/master/sentry-resque/README.md Add these gems to your Gemfile to enable Sentry error reporting for Resque. The gem automatically integrates with Resque. ```ruby gem "sentry-ruby" gem "sentry-resque" ``` -------------------------------- ### Install Sentry Ruby and DelayedJob Gems Source: https://github.com/getsentry/sentry-ruby/blob/master/sentry-delayed_job/README.md Add these gems to your Gemfile to enable Sentry integration with DelayedJob. The gem automatically adds necessary middleware and error handlers. ```ruby gem "sentry-ruby" gem "sentry-delayed_job" ``` -------------------------------- ### Initialize Sentry SDK Source: https://github.com/getsentry/sentry-ruby/blob/master/README.md Initialize the Sentry SDK with your DSN. This is a required step for Sentry to capture and send events. ```ruby require "sentry-ruby" Sentry.init do |config| config.dsn = "MY_DSN" end ``` -------------------------------- ### Configure Performance Monitoring Source: https://github.com/getsentry/sentry-ruby/blob/master/README.md Enable performance monitoring by setting a uniform sample rate for traces. Use `traces_sampler` for more advanced sampling logic. ```ruby Sentry.init do |config| # set a uniform sample rate between 0.0 and 1.0 config.traces_sample_rate = 0.2 # you can also use traces_sampler for more fine-grained sampling # please click the link below to learn more end ``` -------------------------------- ### Run All Tests with Rake Source: https://github.com/getsentry/sentry-ruby/blob/master/CLAUDE.md Execute all tests within a gem's directory using `bundle exec rake`. ```bash bundle exec rake ``` -------------------------------- ### Lint a File with RuboCop Source: https://github.com/getsentry/sentry-ruby/blob/master/CLAUDE.md Use `bundle exec rubocop` to lint a specific file. For automatic fixes, add the `-a` flag. ```bash bundle exec rubocop path/to/file.rb ``` ```bash bundle exec rubocop -a path/to/file.rb ``` -------------------------------- ### Initialize Sentry with Metrics Enabled Source: https://github.com/getsentry/sentry-ruby/blob/master/sentry-yabeda/README.md Initialize Sentry in your application, ensuring that metrics collection is enabled to send Yabeda metrics to Sentry. The DSN should be set via an environment variable. ```ruby Sentry.init do |config| config.dsn = ENV["SENTRY_DSN"] config.enable_metrics = true end ``` -------------------------------- ### Lint a File with RuboCop Source: https://github.com/getsentry/sentry-ruby/blob/master/AGENTS.md Perform linting on a specific file using `bundle exec rubocop` followed by the file path. ```bash bundle exec rubocop path/to/file.rb ``` -------------------------------- ### Configure Performance Monitoring with Traces Sampling Source: https://github.com/getsentry/sentry-ruby/blob/master/sentry-rails/README.md Activate performance monitoring by configuring traces sampling rates or using a dynamic sampler function. This allows Sentry to capture and analyze transaction performance data. ```ruby Sentry.init do |config| # set a uniform sample rate between 0.0 and 1.0 config.traces_sample_rate = 0.2 # or control sampling dynamically config.traces_sampler = lambda do |sampling_context| # sampling_context[:transaction_context] contains the information about the transaction # sampling_context[:parent_sampled] contains the transaction's parent's sample decision true # return value can be a boolean or a float between 0.0 and 1.0 end end ``` -------------------------------- ### Run a Single Spec File Source: https://github.com/getsentry/sentry-ruby/blob/master/CLAUDE.md To run a specific spec file, use `bundle exec rspec` followed by the path to the spec file. ```bash bundle exec rspec spec/sentry/client_spec.rb ``` -------------------------------- ### Lint a File with RuboCop (Autofix) Source: https://github.com/getsentry/sentry-ruby/blob/master/AGENTS.md Automatically fix linting issues in a file using `bundle exec rubocop -a` followed by the file path. ```bash bundle exec rubocop -a path/to/file.rb ``` -------------------------------- ### Configure OpenTelemetry SDK with Sentry Processors Source: https://github.com/getsentry/sentry-ruby/blob/master/sentry-opentelemetry/README.md Configure the OpenTelemetry SDK to use all available instrumentations and add Sentry's SpanProcessor and Propagator. This ensures that spans generated by OpenTelemetry are processed and propagated by Sentry. ```ruby # config/initializers/otel.rb OpenTelemetry::SDK.configure do |c| c.use_all c.add_span_processor(Sentry::OpenTelemetry::SpanProcessor.instance) end OpenTelemetry.propagation = Sentry::OpenTelemetry::Propagator.new ``` -------------------------------- ### Configure Sentry Initialization in Rails Source: https://github.com/getsentry/sentry-ruby/blob/master/sentry-rails/README.md Configure Sentry initialization within your Rails application. This includes options for reporting rescued exceptions and enabling ActiveSupport breadcrumb logging. ```ruby Sentry.init do |config| # report exceptions rescued by ActionDispatch::ShowExceptions or ActionDispatch::DebugExceptions middlewares # the default value is true config.rails.report_rescued_exceptions = true # this gem also provides a new breadcrumb logger that accepts instrumentations from ActiveSupport # it's not activated by default, but you can enable it with config.breadcrumbs_logger = [:active_support_logger] end ``` -------------------------------- ### Configure Sentry with OpenTelemetry Instrumenter Source: https://github.com/getsentry/sentry-ruby/blob/master/sentry-opentelemetry/README.md Initialize Sentry in your Rails application and set the `instrumenter` to `:otel`. This configuration disables Sentry's built-in instrumentation and directs it to use OpenTelemetry tracers. ```ruby # config/initializers/sentry.rb Sentry.init do |config| config.dsn = "MY_DSN" config.traces_sample_rate = 1.0 config.instrumenter = :otel end ``` -------------------------------- ### Register Sentry Ruby Extension Source: https://github.com/getsentry/sentry-ruby/blob/master/EXTENSION.md Register a new integration with the Sentry SDK core. Ensure the extension module is defined under the Sentry namespace and extends `Sentry::Integrable`. ```ruby require "sentry-ruby" # the integrable module needs to be required separately require "sentry/integrable" module Sentry # the module/class of the extension should be defined under the Sentry namespace module Rails # extend the module extend Integrable # use the register_integration method to register your extension to the SDK core register_integration name: "rails", version: Sentry::Rails::VERSION end end ``` -------------------------------- ### Add sentry-rails Gem to Gemfile Source: https://github.com/getsentry/sentry-ruby/blob/master/sentry-rails/README.md To integrate Sentry with your Rails application, add the `sentry-rails` gem to your Gemfile. ```ruby gem "sentry-rails" ``` -------------------------------- ### AI Commit Attribution Source: https://github.com/getsentry/sentry-ruby/blob/master/CLAUDE.md When committing AI-generated code, include the specified 'Co-Authored-By' trailer in the commit message. ```git Co-Authored-By: ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.