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 +4 -4
- data/lib/sentry/configuration.rb +2 -2
- data/lib/sentry/core_ext/object/deep_dup.rb +2 -0
- data/lib/sentry/core_ext/object/duplicable.rb +1 -0
- data/lib/sentry/dsn.rb +0 -1
- data/lib/sentry/event.rb +7 -6
- data/lib/sentry/hub.rb +11 -0
- data/lib/sentry/rake.rb +24 -10
- data/lib/sentry/transaction_event.rb +11 -6
- data/lib/sentry/transport/configuration.rb +2 -1
- data/lib/sentry/utils/real_ip.rb +7 -1
- data/lib/sentry/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 442dc8b92f82ac1873cc066b8188d49ad4673425c2833416b5262c8076e4a13d
|
4
|
+
data.tar.gz: 1c7b5d1d49ebc37da4cd3b524b50e0d50b1e7152cbbeb8f712603a57ceeac53c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5f3aa0e7950fff974c056ac389218d68677804b590e1d94bac250070130630915d72905df42d88d6beb434912f893c3a86a6e0a734c8f6b7e6b91ae44d813e2
|
7
|
+
data.tar.gz: d5f973ca005648a658c71e2c2e2a336bf68f7511b856147b4f8bcacd6234bf6d950e37d97af422dfc0c730f75e57e0e7a1ec41e2c819ed6cb222a811494d55e1
|
data/lib/sentry/configuration.rb
CHANGED
@@ -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
|
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
|
408
|
+
if Random.rand >= sample_rate
|
409
409
|
@errors << "Excluded by random sample"
|
410
410
|
false
|
411
411
|
else
|
data/lib/sentry/dsn.rb
CHANGED
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
|
-
|
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
|
-
|
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::
|
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
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
18
|
-
|
21
|
+
def initialize(configuration:, integration_meta: nil, message: nil)
|
22
|
+
super
|
23
|
+
@type = TYPE
|
19
24
|
end
|
20
25
|
|
21
|
-
def
|
22
|
-
|
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
|
-
:
|
5
|
+
:encoding
|
6
|
+
attr_reader :transport_class
|
6
7
|
|
7
8
|
def initialize
|
8
9
|
@ssl_verification = true
|
data/lib/sentry/utils/real_ip.rb
CHANGED
@@ -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
|
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
|
data/lib/sentry/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2021-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|