sentry-rails 5.10.0 → 5.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7eadae379dbfc72a3685f48b7379a52c1fea827eb4c57d1eba6565f87cad406f
4
- data.tar.gz: 81a628792cffda07caed69c4fc5191c77f27da32cfe70226bfac3aeda3951c33
3
+ metadata.gz: b7ddebe5d3603e4e463a85c866633a8efc2c9a4e559450b29a1a23f9e62862d7
4
+ data.tar.gz: a4e5938fd4d4ca9af782e1934edb6818c9bb5d033fbd52e6181f808c72e7be80
5
5
  SHA512:
6
- metadata.gz: 0b8575d57dd6be491b3221c40a62864ac183a26274717f122a67d61300f093ff215e38ad182a301db9cc0f57e1d3a257e564bb845aca86429b96574baf901c2a
7
- data.tar.gz: 68e82698caa67fb3d5d7643e86379015dde236ffd38de7a560af0e207d48928643becc8918b7f4aa48cf533c849b4b6f3496f3cc9513f61408545e80e8811212
6
+ metadata.gz: 7a480ba7bf4e4c0a5790b7debdc1a35b2fc5c6c707804530acfd0699fd2cb0f45c8df4ae933c37d5e18d1fa24e6e7a23954f71aada985031111d4aa863f5c986
7
+ data.tar.gz: 69aab97414157f65969b57bd2585d123f5dd3ba87268c86d61f1d9ae77d42efd8c8b969ee0a10392037210d873f188ecc359a467573e174391d324feadc6540c
data/.gitignore CHANGED
@@ -5,7 +5,7 @@
5
5
  /doc/
6
6
  /pkg/
7
7
  /spec/reports/
8
- /spec/dummy/test_rails_app/db
8
+ /spec/dummy/test_rails_app/db*
9
9
  /tmp/
10
10
 
11
11
  # rspec failure tracking
data/Gemfile CHANGED
@@ -11,7 +11,7 @@ platform :jruby do
11
11
  end
12
12
 
13
13
  rails_version = ENV["RAILS_VERSION"]
14
- rails_version = "7.0.0" if rails_version.nil?
14
+ rails_version = "7.1.0" if rails_version.nil?
15
15
  rails_version = Gem::Version.new(rails_version)
16
16
 
17
17
  if rails_version < Gem::Version.new("6.0.0")
@@ -20,10 +20,13 @@ else
20
20
  gem "sqlite3", platform: :ruby
21
21
  end
22
22
 
23
- if rails_version > Gem::Version.new("7.0.0")
23
+ if rails_version >= Gem::Version.new("7.2.0.alpha")
24
24
  gem "rails", github: "rails/rails"
25
+ elsif rails_version >= Gem::Version.new("7.1.0")
26
+ gem "rails", "~> #{rails_version}"
25
27
  else
26
28
  gem "rails", "~> #{rails_version}"
29
+ gem "psych", "~> 3.0.0"
27
30
  end
28
31
 
29
32
  gem "mini_magick"
@@ -39,17 +42,25 @@ gem 'simplecov'
39
42
  gem "simplecov-cobertura", "~> 1.4"
40
43
  gem "rexml"
41
44
 
42
- # https://github.com/flavorjones/loofah/pull/267
43
- # loofah changed the required ruby version in a patch so we need to explicitly pin it
44
- gem "loofah", "2.20.0" if RUBY_VERSION.to_f < 2.5
45
+ ruby_version = Gem::Version.new(RUBY_VERSION)
45
46
 
46
- gem "rake", "~> 12.0"
47
+ if ruby_version < Gem::Version.new("2.5.0")
48
+ # https://github.com/flavorjones/loofah/pull/267
49
+ # loofah changed the required ruby version in a patch so we need to explicitly pin it
50
+ gem "loofah", "2.20.0"
51
+ end
47
52
 
48
- if RUBY_VERSION.to_f >= 2.6
53
+ if ruby_version >= Gem::Version.new("2.6.0")
49
54
  gem "debug", github: "ruby/debug", platform: :ruby
50
55
  gem "irb"
56
+
57
+ if ruby_version >= Gem::Version.new("3.0.0")
58
+ gem "ruby-lsp-rspec"
59
+ end
51
60
  end
52
61
 
62
+ gem "rake", "~> 12.0"
63
+
53
64
  gem "pry"
54
65
 
55
66
  gem "benchmark-ips"
data/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
 
12
12
 
13
13
  [![Gem Version](https://img.shields.io/gem/v/sentry-rails.svg)](https://rubygems.org/gems/sentry-rails)
14
- ![Build Status](https://github.com/getsentry/sentry-ruby/workflows/sentry-rails%20Test/badge.svg)
14
+ ![Build Status](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_rails_test.yml/badge.svg)
15
15
  [![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/sentry-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/sentry-ruby/branch/master)
16
16
  [![Gem](https://img.shields.io/gem/dt/sentry-rails.svg)](https://rubygems.org/gems/sentry-rails/)
17
17
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-rails&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-rails&package-manager=bundler&version-scheme=semver)
@@ -33,11 +33,8 @@ module Sentry
33
33
  end
34
34
 
35
35
  def start_transaction(env, scope)
36
- sentry_trace = env["HTTP_SENTRY_TRACE"]
37
- baggage = env["HTTP_BAGGAGE"]
38
-
39
36
  options = { name: scope.transaction_name, source: scope.transaction_source, op: OP_NAME }
40
- transaction = Sentry::Transaction.from_sentry_trace(sentry_trace, baggage: baggage, **options) if sentry_trace
37
+ transaction = Sentry.continue_trace(env, **options)
41
38
  Sentry.start_transaction(transaction: transaction, **options)
42
39
  end
43
40
 
@@ -32,16 +32,13 @@ module Sentry
32
32
  end
33
33
 
34
34
  def start_transaction(env, scope)
35
- sentry_trace = env["HTTP_SENTRY_TRACE"]
36
- baggage = env["HTTP_BAGGAGE"]
37
-
38
35
  options = { name: scope.transaction_name, source: scope.transaction_source, op: transaction_op }
39
36
 
40
37
  if @assets_regexp && scope.transaction_name.match?(@assets_regexp)
41
38
  options.merge!(sampled: false)
42
39
  end
43
40
 
44
- transaction = Sentry::Transaction.from_sentry_trace(sentry_trace, baggage: baggage, **options) if sentry_trace
41
+ transaction = Sentry.continue_trace(env, **options)
45
42
  Sentry.start_transaction(transaction: transaction, custom_sampling_context: { env: env }, **options)
46
43
  end
47
44
 
@@ -12,7 +12,12 @@ module Sentry
12
12
  @excluded_exceptions = @excluded_exceptions.concat(Sentry::Rails::IGNORE_DEFAULT)
13
13
 
14
14
  if ::Rails.logger
15
- @logger = ::Rails.logger
15
+ if ::Rails.logger.respond_to?(:broadcasts)
16
+ dupped_broadcasts = ::Rails.logger.broadcasts.map(&:dup)
17
+ @logger = ::ActiveSupport::BroadcastLogger.new(*dupped_broadcasts)
18
+ else
19
+ @logger = ::Rails.logger.dup
20
+ end
16
21
  else
17
22
  @logger.warn(Sentry::LOGGER_PROGNAME) do
18
23
  <<~MSG
@@ -13,8 +13,33 @@ module Sentry
13
13
  next if EXCLUDED_EVENTS.include? payload[:name]
14
14
 
15
15
  record_on_current_span(op: SPAN_PREFIX + event_name, start_timestamp: payload[START_TIMESTAMP_NAME], description: payload[:sql], duration: duration) do |span|
16
- span.set_data(:connection_id, payload[:connection_id])
17
16
  span.set_tag(:cached, true) if payload.fetch(:cached, false) # cached key is only set for hits in the QueryCache, from Rails 5.1
17
+
18
+ connection = payload[:connection]
19
+
20
+ if payload[:connection_id]
21
+ span.set_data(:connection_id, payload[:connection_id])
22
+
23
+ # we fallback to the base connection on rails < 6.0.0 since the payload doesn't have it
24
+ base_connection = ActiveRecord::Base.connection
25
+ connection ||= base_connection if payload[:connection_id] == base_connection.object_id
26
+ end
27
+
28
+ next unless connection
29
+
30
+ db_config = if connection.pool.respond_to?(:db_config)
31
+ connection.pool.db_config.configuration_hash
32
+ elsif connection.pool.respond_to?(:spec)
33
+ connection.pool.spec.config
34
+ end
35
+
36
+ next unless db_config
37
+
38
+ span.set_data(Span::DataConventions::DB_SYSTEM, db_config[:adapter]) if db_config[:adapter]
39
+ span.set_data(Span::DataConventions::DB_NAME, db_config[:database]) if db_config[:database]
40
+ span.set_data(Span::DataConventions::SERVER_ADDRESS, db_config[:host]) if db_config[:host]
41
+ span.set_data(Span::DataConventions::SERVER_PORT, db_config[:port]) if db_config[:port]
42
+ span.set_data(Span::DataConventions::SERVER_SOCKET_ADDRESS, db_config[:socket]) if db_config[:socket]
18
43
  end
19
44
  end
20
45
  end
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Rails
3
- VERSION = "5.10.0"
3
+ VERSION = "5.12.0"
4
4
  end
5
5
  end
data/sentry-rails.gemspec CHANGED
@@ -23,5 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ["lib"]
24
24
 
25
25
  spec.add_dependency "railties", ">= 5.0"
26
- spec.add_dependency "sentry-ruby", "~> 5.10.0"
26
+ spec.add_dependency "sentry-ruby", "~> 5.12.0"
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.10.0
4
+ version: 5.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-04 00:00:00.000000000 Z
11
+ date: 2023-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 5.10.0
33
+ version: 5.12.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 5.10.0
40
+ version: 5.12.0
41
41
  description: A gem that provides Rails integration for the Sentry error logger
42
42
  email: accounts@sentry.io
43
43
  executables: []