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

Drop Gem::Specification's usage so it doesn't break bundler standalone #2335

Merged
merged 5 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading