sentry-ruby-core 4.6.0 → 4.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfe5056c156c748700100bc8c0a08188547f04ef0c09d7ee7653c084407e294e
4
- data.tar.gz: 63562591edc3eb48be9e0cf22ab17a3787a5ee91784978252dd67dd050128abe
3
+ metadata.gz: 442dc8b92f82ac1873cc066b8188d49ad4673425c2833416b5262c8076e4a13d
4
+ data.tar.gz: 1c7b5d1d49ebc37da4cd3b524b50e0d50b1e7152cbbeb8f712603a57ceeac53c
5
5
  SHA512:
6
- metadata.gz: 777e2a93032b22c039dec36aa8eb859de7169a0cb438d3204bb7620a0e290ff8a4b747c196ff093008d2fe61f066cf6368d8bddda2fba9e7127ec4985ca1968a
7
- data.tar.gz: 35bb4ff5ab8d01fbd1d2882b2e3f0382a24248bca2e3b3a2be80a2e80c8fea6d5e10316b9c8962407e43f72a84cae3f201c8dadf4f80526cd584d9c238aa47a1
6
+ metadata.gz: e5f3aa0e7950fff974c056ac389218d68677804b590e1d94bac250070130630915d72905df42d88d6beb434912f893c3a86a6e0a734c8f6b7e6b91ae44d813e2
7
+ data.tar.gz: d5f973ca005648a658c71e2c2e2a336bf68f7511b856147b4f8bcacd6234bf6d950e37d97af422dfc0c730f75e57e0e7a1ec41e2c819ed6cb222a811494d55e1
@@ -89,7 +89,7 @@ module Sentry
89
89
  # You should probably append to this rather than overwrite it.
90
90
  attr_accessor :excluded_exceptions
91
91
 
92
- # Boolean to check nested exceptions when deciding if to exclude. Defaults to false
92
+ # Boolean to check nested exceptions when deciding if to exclude. Defaults to true
93
93
  attr_accessor :inspect_exception_causes_for_exclusion
94
94
  alias inspect_exception_causes_for_exclusion? inspect_exception_causes_for_exclusion
95
95
 
@@ -405,7 +405,7 @@ module Sentry
405
405
  def sample_allowed?
406
406
  return true if sample_rate == 1.0
407
407
 
408
- if Random::DEFAULT.rand >= sample_rate
408
+ if Random.rand >= sample_rate
409
409
  @errors << "Excluded by random sample"
410
410
  false
411
411
  else
@@ -1,3 +1,5 @@
1
+ return if Object.method_defined?(:deep_dup)
2
+
1
3
  require 'sentry/core_ext/object/duplicable'
2
4
 
3
5
  #########################################
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ return if Object.method_defined?(:duplicable?)
2
3
 
3
4
  #########################################
4
5
  # This file was copied from Rails 5.2 #
data/lib/sentry/dsn.rb CHANGED
@@ -37,7 +37,6 @@ module Sentry
37
37
  def server
38
38
  server = "#{scheme}://#{host}"
39
39
  server += ":#{port}" unless port == PORT_MAP[scheme]
40
- server += path
41
40
  server
42
41
  end
43
42
 
data/lib/sentry/event.rb CHANGED
@@ -9,7 +9,7 @@ require 'sentry/utils/request_id'
9
9
 
10
10
  module Sentry
11
11
  class Event
12
- ATTRIBUTES = %i(
12
+ SERIALIZEABLE_ATTRIBUTES = %i(
13
13
  event_id level timestamp
14
14
  release environment server_name modules
15
15
  message user tags contexts extra
@@ -17,9 +17,13 @@ module Sentry
17
17
  platform sdk type
18
18
  )
19
19
 
20
+ WRITER_ATTRIBUTES = SERIALIZEABLE_ATTRIBUTES - %i(type timestamp level)
21
+
20
22
  MAX_MESSAGE_SIZE_IN_BYTES = 1024 * 8
21
23
 
22
- attr_accessor(*ATTRIBUTES)
24
+ attr_writer(*WRITER_ATTRIBUTES)
25
+ attr_reader(*SERIALIZEABLE_ATTRIBUTES)
26
+
23
27
  attr_reader :configuration, :request, :exception, :threads
24
28
 
25
29
  def initialize(configuration:, integration_meta: nil, message: nil)
@@ -99,9 +103,6 @@ module Sentry
99
103
  end
100
104
  end
101
105
 
102
- def type
103
- end
104
-
105
106
  def to_hash
106
107
  data = serialize_attributes
107
108
  data[:breadcrumbs] = breadcrumbs.to_hash if breadcrumbs
@@ -139,7 +140,7 @@ module Sentry
139
140
  private
140
141
 
141
142
  def serialize_attributes
142
- self.class::ATTRIBUTES.each_with_object({}) do |att, memo|
143
+ self.class::SERIALIZEABLE_ATTRIBUTES.each_with_object({}) do |att, memo|
143
144
  if value = public_send(att)
144
145
  memo[att] = value
145
146
  end
data/lib/sentry/hub.rb CHANGED
@@ -144,6 +144,17 @@ module Sentry
144
144
  current_scope.add_breadcrumb(breadcrumb)
145
145
  end
146
146
 
147
+ # this doesn't do anything to the already initialized background worker
148
+ # but it temporarily disables dispatching events to it
149
+ def with_background_worker_disabled(&block)
150
+ original_background_worker_threads = configuration.background_worker_threads
151
+ configuration.background_worker_threads = 0
152
+
153
+ block.call
154
+ ensure
155
+ configuration.background_worker_threads = original_background_worker_threads
156
+ end
157
+
147
158
  private
148
159
 
149
160
  def current_layer
data/lib/sentry/rake.rb CHANGED
@@ -1,17 +1,31 @@
1
1
  require "rake"
2
2
  require "rake/task"
3
3
 
4
- module Rake
5
- class Application
6
- alias orig_display_error_messsage display_error_message
7
- def display_error_message(ex)
8
- Sentry.capture_exception(ex, hint: { background: false }) do |scope|
9
- task_name = top_level_tasks.join(' ')
10
- scope.set_transaction_name(task_name)
11
- scope.set_tag("rake_task", task_name)
12
- end if Sentry.initialized? && !Sentry.configuration.skip_rake_integration
4
+ module Sentry
5
+ module Rake
6
+ module Application
7
+ def display_error_message(ex)
8
+ Sentry.capture_exception(ex, hint: { background: false }) do |scope|
9
+ task_name = top_level_tasks.join(' ')
10
+ scope.set_transaction_name(task_name)
11
+ scope.set_tag("rake_task", task_name)
12
+ end if Sentry.initialized? && !Sentry.configuration.skip_rake_integration
13
13
 
14
- orig_display_error_messsage(ex)
14
+ super
15
+ end
16
+ end
17
+
18
+ module Task
19
+ def execute(args=nil)
20
+ return super unless Sentry.initialized? && Sentry.get_current_hub
21
+
22
+ Sentry.get_current_hub.with_background_worker_disabled do
23
+ super
24
+ end
25
+ end
15
26
  end
16
27
  end
17
28
  end
29
+
30
+ Rake::Application.prepend(Sentry::Rake::Application)
31
+ Rake::Task.prepend(Sentry::Rake::Task)
@@ -4,22 +4,27 @@ module Sentry
4
4
  class TransactionEvent < Event
5
5
  TYPE = "transaction"
6
6
 
7
- ATTRIBUTES = %i(
7
+ SERIALIZEABLE_ATTRIBUTES = %i(
8
8
  event_id level timestamp start_timestamp
9
9
  release environment server_name modules
10
10
  user tags contexts extra
11
11
  transaction platform sdk type
12
12
  )
13
13
 
14
- attr_accessor(*ATTRIBUTES)
14
+ WRITER_ATTRIBUTES = SERIALIZEABLE_ATTRIBUTES - %i(type timestamp start_timestamp level)
15
+
16
+ attr_writer(*WRITER_ATTRIBUTES)
17
+ attr_reader(*SERIALIZEABLE_ATTRIBUTES)
18
+
15
19
  attr_accessor :spans
16
20
 
17
- def start_timestamp=(time)
18
- @start_timestamp = time.is_a?(Time) ? time.to_f : time
21
+ def initialize(configuration:, integration_meta: nil, message: nil)
22
+ super
23
+ @type = TYPE
19
24
  end
20
25
 
21
- def type
22
- TYPE
26
+ def start_timestamp=(time)
27
+ @start_timestamp = time.is_a?(Time) ? time.to_f : time
23
28
  end
24
29
 
25
30
  def to_hash
@@ -2,7 +2,8 @@ module Sentry
2
2
  class Transport
3
3
  class Configuration
4
4
  attr_accessor :timeout, :open_timeout, :proxy, :ssl, :ssl_ca_file, :ssl_verification, :http_adapter, :faraday_builder,
5
- :transport_class, :encoding
5
+ :encoding
6
+ attr_reader :transport_class
6
7
 
7
8
  def initialize
8
9
  @ssl_verification = true
@@ -29,7 +29,13 @@ module Sentry
29
29
  @client_ip = client_ip
30
30
  @real_ip = real_ip
31
31
  @forwarded_for = forwarded_for
32
- @trusted_proxies = (LOCAL_ADDRESSES + Array(trusted_proxies)).map { |proxy| IPAddr.new(proxy.to_s) }.uniq
32
+ @trusted_proxies = (LOCAL_ADDRESSES + Array(trusted_proxies)).map do |proxy|
33
+ if proxy.is_a?(IPAddr)
34
+ proxy
35
+ else
36
+ IPAddr.new(proxy.to_s)
37
+ end
38
+ end.uniq
33
39
  end
34
40
 
35
41
  def calculate_ip
@@ -1,3 +1,3 @@
1
1
  module Sentry
2
- VERSION = "4.6.0"
2
+ VERSION = "4.6.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-ruby-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.0
4
+ version: 4.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sentry Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-30 00:00:00.000000000 Z
11
+ date: 2021-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday