Skip to content

Commit

Permalink
Drop Gem::Specification's usage so it doesn't break bundler standal…
Browse files Browse the repository at this point in the history
…one (#2335)

* Bump sqlite3 to 1.7.* series for Ruby 3.3

* Avoid using Gem::Specification to determine Sentry gems' paths

This will break users with bundler standalone setup.

* Update changelog
  • Loading branch information
st0012 authored Jul 2, 2024
1 parent 069de02 commit 653b06f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_batch_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
ruby-version: 3.3
- name: Build gem source
run: ruby .scripts/batch_build.rb
- name: Archive Artifacts
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## Unreleased

### Bug Fixes

- Drop `Gem::Specification`'s usage so it doesn't break bundler standalone ([#2335](https://github.com/getsentry/sentry-ruby/pull/2335))

## 5.18.0

### Features
Expand Down
7 changes: 5 additions & 2 deletions sentry-rails/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ rails_version = Gem::Version.new(rails_version)
if rails_version < Gem::Version.new("6.0.0")
gem "sqlite3", "~> 1.3.0", platform: :ruby
else
# 1.7.0 dropped support for ruby < 3.0, remove later after upgrading craft setup
gem "sqlite3", "1.6.9", platform: :ruby
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.0")
gem "sqlite3", "~> 1.7.3", platform: :ruby
else
gem "sqlite3", "~> 1.6.9", platform: :ruby
end
end

if rails_version >= Gem::Version.new("7.2.0.alpha")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# frozen_string_literal: true

require "sentry/rails/tracing/abstract_subscriber"

module Sentry
module Rails
module Tracing
class ActiveRecordSubscriber < AbstractSubscriber
EVENT_NAMES = ["sql.active_record"].freeze
SPAN_PREFIX = "db.".freeze
SPAN_ORIGIN = "auto.db.rails".freeze
SPAN_PREFIX = "db."
SPAN_ORIGIN = "auto.db.rails"
EXCLUDED_EVENTS = ["SCHEMA", "TRANSACTION"].freeze

SUPPORT_SOURCE_LOCATION = ActiveSupport::BacktraceCleaner.method_defined?(:clean_frame)

if SUPPORT_SOURCE_LOCATION
# Need to be specific down to the lib path so queries generated in specs don't get ignored
SENTRY_RUBY_PATH = File.join(Gem::Specification.find_by_name("sentry-ruby").full_gem_path, "lib")
SENTRY_RAILS_PATH = File.join(Gem::Specification.find_by_name("sentry-rails").full_gem_path, "lib")

class_attribute :backtrace_cleaner, default: (ActiveSupport::BacktraceCleaner.new.tap do |cleaner|
cleaner.add_silencer { |line| line.include?(SENTRY_RUBY_PATH) || line.include?(SENTRY_RAILS_PATH) }
cleaner.add_silencer { |line| line.include?("sentry-ruby/lib") || line.include?("sentry-rails/lib") }
end)
end

Expand Down

0 comments on commit 653b06f

Please sign in to comment.