sentry-rails 5.10.0 → 5.11.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: 39ae75bb0a992ced9247272ab6d20ff61aee51ee2a9a02f309204fb01533aae3
4
+ data.tar.gz: 6a00192e48a695c90ed994ccdb40cc4def17c1263c1c469d2c7daac5f933607b
5
5
  SHA512:
6
- metadata.gz: 0b8575d57dd6be491b3221c40a62864ac183a26274717f122a67d61300f093ff215e38ad182a301db9cc0f57e1d3a257e564bb845aca86429b96574baf901c2a
7
- data.tar.gz: 68e82698caa67fb3d5d7643e86379015dde236ffd38de7a560af0e207d48928643becc8918b7f4aa48cf533c849b4b6f3496f3cc9513f61408545e80e8811212
6
+ metadata.gz: a99466d8bbab1261f08b0bdf2a1394e5dfb473fc53e9f4af91fb67411ef668c2e49c26496be127a7e2f5350c4d745388eddb0f357963caafe966a77cc8ce3028
7
+ data.tar.gz: 33f3d414890890cda3529d8f21f916f74db743ce466b8fc7f70a1529a659d1be6360f6e98097ddf30ea896c8d85c497acd2e73c1831d1025fcc669f56f6562e5
data/Gemfile CHANGED
@@ -47,7 +47,12 @@ gem "rake", "~> 12.0"
47
47
 
48
48
  if RUBY_VERSION.to_f >= 2.6
49
49
  gem "debug", github: "ruby/debug", platform: :ruby
50
- gem "irb"
50
+
51
+ if rails_version == Gem::Version.new("6.0.0") && RUBY_VERSION.to_f == 2.7
52
+ gem "irb", "~> 1.7.4" # irb 1.8 adds psych via rdoc that causes CI to fail
53
+ else
54
+ gem "irb"
55
+ end
51
56
  end
52
57
 
53
58
  gem "pry"
@@ -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,7 @@ 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
+ @logger = ::Rails.logger.dup
16
16
  else
17
17
  @logger.warn(Sentry::LOGGER_PROGNAME) do
18
18
  <<~MSG
@@ -13,8 +13,31 @@ 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
+ span.set_data(Span::DataConventions::DB_SYSTEM, db_config[:adapter]) if db_config[:adapter]
37
+ span.set_data(Span::DataConventions::DB_NAME, db_config[:database]) if db_config[:database]
38
+ span.set_data(Span::DataConventions::SERVER_ADDRESS, db_config[:host]) if db_config[:host]
39
+ span.set_data(Span::DataConventions::SERVER_PORT, db_config[:port]) if db_config[:port]
40
+ span.set_data(Span::DataConventions::SERVER_SOCKET_ADDRESS, db_config[:socket]) if db_config[:socket]
18
41
  end
19
42
  end
20
43
  end
@@ -1,5 +1,5 @@
1
1
  module Sentry
2
2
  module Rails
3
- VERSION = "5.10.0"
3
+ VERSION = "5.11.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.11.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.11.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-09-06 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.11.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.11.0
41
41
  description: A gem that provides Rails integration for the Sentry error logger
42
42
  email: accounts@sentry.io
43
43
  executables: []