sentry-ruby-core 4.4.1 → 4.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/Gemfile +3 -4
- data/lib/sentry-ruby.rb +3 -0
- data/lib/sentry/breadcrumb.rb +7 -2
- data/lib/sentry/client.rb +9 -1
- data/lib/sentry/configuration.rb +13 -4
- data/lib/sentry/net/http.rb +38 -2
- data/lib/sentry/rack.rb +0 -1
- data/lib/sentry/rake.rb +1 -1
- data/lib/sentry/transport.rb +1 -1
- data/lib/sentry/version.rb +1 -1
- data/sentry-ruby-core.gemspec +1 -1
- data/sentry-ruby.gemspec +1 -1
- metadata +4 -7
- data/.craft.yml +0 -29
- data/lib/sentry/benchmarks/benchmark_transport.rb +0 -14
- data/lib/sentry/rack/deprecations.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '069a03a0f4a0191b4a8a5ba1c7827e9c78423aea7d46f84a5112f7a4508a2f44'
|
4
|
+
data.tar.gz: df513f743bd7804084a42e8cf7dd8413bfd674e1a05fdbfaf1cc395a420237aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6586e7232c920d247ef5f8f837f1b759a52c48cbcb2c5caafc5e5097a3f803c86b9050b3b0cd4e6a648b4cda59b20ddc31e80a74dc5f6fabe93437a3da89938b
|
7
|
+
data.tar.gz: 4e0a36a001307b41b0d4fc03705b2d520bbc61ee1e1ecabc4a62a262f05b336e484771d9b0ca23ce92e4e8ba0eb60ca9bc3f40acce3be0b4946ca61336d362f5
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
Individual gem's changelog has been deprecated. Please check the [project changelog](https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md).
|
4
|
+
|
5
|
+
## 4.4.2
|
6
|
+
|
7
|
+
- Fix NoMethodError when SDK's dsn is nil [#1433](https://github.com/getsentry/sentry-ruby/pull/1433)
|
8
|
+
- fix: Update protocol version to 7 [#1434](https://github.com/getsentry/sentry-ruby/pull/1434)
|
9
|
+
- Fixes [#867](https://github.com/getsentry/sentry-ruby/issues/867)
|
10
|
+
|
3
11
|
## 4.4.1
|
4
12
|
|
5
13
|
- Apply patches when initializing the SDK [#1432](https://github.com/getsentry/sentry-ruby/pull/1432)
|
data/Gemfile
CHANGED
@@ -3,8 +3,7 @@ source "https://rubygems.org"
|
|
3
3
|
gem "sentry-ruby-core", path: "./"
|
4
4
|
gem "sentry-ruby", path: "./"
|
5
5
|
|
6
|
-
|
7
|
-
gem "i18n", "<= 1.8.7"
|
6
|
+
gem "rack" unless ENV["WITHOUT_RACK"] == "1"
|
8
7
|
|
9
8
|
gem "rake", "~> 12.0"
|
10
9
|
gem "rspec", "~> 3.0"
|
@@ -12,10 +11,10 @@ gem "rspec-retry"
|
|
12
11
|
gem "webmock"
|
13
12
|
gem "timecop"
|
14
13
|
gem "codecov", "0.2.12"
|
15
|
-
gem "tapping_device"
|
16
14
|
|
15
|
+
gem "object_tracer"
|
16
|
+
gem "debug", github: "ruby/debug" if RUBY_VERSION.to_f >= 2.6
|
17
17
|
gem "pry"
|
18
|
-
gem "rack" unless ENV["WITHOUT_RACK"] == "1"
|
19
18
|
|
20
19
|
gem "benchmark-ips"
|
21
20
|
gem "benchmark_driver"
|
data/lib/sentry-ruby.rb
CHANGED
@@ -32,6 +32,8 @@ module Sentry
|
|
32
32
|
|
33
33
|
LOGGER_PROGNAME = "sentry".freeze
|
34
34
|
|
35
|
+
SENTRY_TRACE_HEADER_NAME = "sentry-trace".freeze
|
36
|
+
|
35
37
|
THREAD_LOCAL = :sentry_hub
|
36
38
|
|
37
39
|
def self.sdk_meta
|
@@ -82,6 +84,7 @@ module Sentry
|
|
82
84
|
def init(&block)
|
83
85
|
config = Configuration.new
|
84
86
|
yield(config) if block_given?
|
87
|
+
config.detect_release
|
85
88
|
apply_patches(config)
|
86
89
|
client = Client.new(config)
|
87
90
|
scope = Scope.new(max_breadcrumbs: config.max_breadcrumbs)
|
data/lib/sentry/breadcrumb.rb
CHANGED
@@ -2,15 +2,16 @@ module Sentry
|
|
2
2
|
class Breadcrumb
|
3
3
|
DATA_SERIALIZATION_ERROR_MESSAGE = "[data were removed due to serialization issues]"
|
4
4
|
|
5
|
-
attr_accessor :category, :data, :
|
5
|
+
attr_accessor :category, :data, :level, :timestamp, :type
|
6
|
+
attr_reader :message
|
6
7
|
|
7
8
|
def initialize(category: nil, data: nil, message: nil, timestamp: nil, level: nil, type: nil)
|
8
9
|
@category = category
|
9
10
|
@data = data || {}
|
10
11
|
@level = level
|
11
|
-
@message = message
|
12
12
|
@timestamp = timestamp || Sentry.utc_now.to_i
|
13
13
|
@type = type
|
14
|
+
self.message = message
|
14
15
|
end
|
15
16
|
|
16
17
|
def to_hash
|
@@ -24,6 +25,10 @@ module Sentry
|
|
24
25
|
}
|
25
26
|
end
|
26
27
|
|
28
|
+
def message=(msg)
|
29
|
+
@message = (msg || "").byteslice(0..Event::MAX_MESSAGE_SIZE_IN_BYTES)
|
30
|
+
end
|
31
|
+
|
27
32
|
private
|
28
33
|
|
29
34
|
def serialized_data
|
data/lib/sentry/client.rb
CHANGED
@@ -30,7 +30,7 @@ module Sentry
|
|
30
30
|
|
31
31
|
if async_block = configuration.async
|
32
32
|
dispatch_async_event(async_block, event, hint)
|
33
|
-
elsif hint.fetch(:background, true)
|
33
|
+
elsif configuration.background_worker_threads != 0 && hint.fetch(:background, true)
|
34
34
|
dispatch_background_event(event, hint)
|
35
35
|
else
|
36
36
|
send_event(event, hint)
|
@@ -95,6 +95,14 @@ module Sentry
|
|
95
95
|
raise
|
96
96
|
end
|
97
97
|
|
98
|
+
def generate_sentry_trace(span)
|
99
|
+
return unless configuration.propagate_traces
|
100
|
+
|
101
|
+
trace = span.to_sentry_trace
|
102
|
+
log_debug("[Tracing] Adding #{SENTRY_TRACE_HEADER_NAME} header to outgoing request: #{trace}")
|
103
|
+
trace
|
104
|
+
end
|
105
|
+
|
98
106
|
private
|
99
107
|
|
100
108
|
def dispatch_background_event(event, hint)
|
data/lib/sentry/configuration.rb
CHANGED
@@ -106,6 +106,9 @@ module Sentry
|
|
106
106
|
# Set automatically for Rails.
|
107
107
|
attr_reader :project_root
|
108
108
|
|
109
|
+
# Insert sentry-trace to outgoing requests' headers
|
110
|
+
attr_accessor :propagate_traces
|
111
|
+
|
109
112
|
# Array of rack env parameters to be included in the event sent to sentry.
|
110
113
|
attr_accessor :rack_env_whitelist
|
111
114
|
|
@@ -127,6 +130,9 @@ module Sentry
|
|
127
130
|
# will not be sent to Sentry.
|
128
131
|
attr_accessor :send_default_pii
|
129
132
|
|
133
|
+
# Allow to skip Sentry emails within rake tasks
|
134
|
+
attr_accessor :skip_rake_integration
|
135
|
+
|
130
136
|
# IP ranges for trusted proxies that will be skipped when calculating IP address.
|
131
137
|
attr_accessor :trusted_proxies
|
132
138
|
|
@@ -190,11 +196,12 @@ module Sentry
|
|
190
196
|
self.linecache = ::Sentry::LineCache.new
|
191
197
|
self.logger = ::Sentry::Logger.new(STDOUT)
|
192
198
|
self.project_root = Dir.pwd
|
199
|
+
self.propagate_traces = true
|
193
200
|
|
194
|
-
self.release = detect_release
|
195
201
|
self.sample_rate = 1.0
|
196
202
|
self.send_modules = true
|
197
203
|
self.send_default_pii = false
|
204
|
+
self.skip_rake_integration = false
|
198
205
|
self.trusted_proxies = []
|
199
206
|
self.dsn = ENV['SENTRY_DSN']
|
200
207
|
self.server_name = server_name_from_env
|
@@ -306,10 +313,10 @@ module Sentry
|
|
306
313
|
)
|
307
314
|
end
|
308
315
|
|
309
|
-
private
|
310
|
-
|
311
316
|
def detect_release
|
312
|
-
|
317
|
+
return unless sending_allowed?
|
318
|
+
|
319
|
+
self.release ||= detect_release_from_env ||
|
313
320
|
detect_release_from_git ||
|
314
321
|
detect_release_from_capistrano ||
|
315
322
|
detect_release_from_heroku
|
@@ -317,6 +324,8 @@ module Sentry
|
|
317
324
|
log_error("Error detecting release", e, debug: debug)
|
318
325
|
end
|
319
326
|
|
327
|
+
private
|
328
|
+
|
320
329
|
def excluded_exception?(incoming_exception)
|
321
330
|
excluded_exception_classes.any? do |excluded_exception|
|
322
331
|
matches_exception?(excluded_exception, incoming_exception)
|
data/lib/sentry/net/http.rb
CHANGED
@@ -5,7 +5,36 @@ module Sentry
|
|
5
5
|
module HTTP
|
6
6
|
OP_NAME = "net.http"
|
7
7
|
|
8
|
+
# To explain how the entire thing works, we need to know how the original Net::HTTP#request works
|
9
|
+
# Here's part of its definition. As you can see, it usually calls itself inside a #start block
|
10
|
+
#
|
11
|
+
# ```
|
12
|
+
# def request(req, body = nil, &block)
|
13
|
+
# unless started?
|
14
|
+
# start {
|
15
|
+
# req['connection'] ||= 'close'
|
16
|
+
# return request(req, body, &block) # <- request will be called for the second time from the first call
|
17
|
+
# }
|
18
|
+
# end
|
19
|
+
# # .....
|
20
|
+
# end
|
21
|
+
# ```
|
22
|
+
#
|
23
|
+
# So when the entire flow looks like this:
|
24
|
+
#
|
25
|
+
# 1. #request is called.
|
26
|
+
# - But because the request hasn't started yet, it calls #start (which then calls #do_start)
|
27
|
+
# - At this moment @sentry_span is still nil, so #set_sentry_trace_header returns early
|
28
|
+
# 2. #do_start then creates a new Span and assigns it to @sentry_span
|
29
|
+
# 3. #request is called for the second time.
|
30
|
+
# - This time @sentry_span should present. So #set_sentry_trace_header will set the sentry-trace header on the request object
|
31
|
+
# 4. Once the request finished, it
|
32
|
+
# - Records a breadcrumb if http_logger is set
|
33
|
+
# - Finishes the Span inside @sentry_span and clears the instance variable
|
34
|
+
#
|
8
35
|
def request(req, body = nil, &block)
|
36
|
+
set_sentry_trace_header(req)
|
37
|
+
|
9
38
|
super.tap do |res|
|
10
39
|
record_sentry_breadcrumb(req, res)
|
11
40
|
record_sentry_span(req, res)
|
@@ -26,6 +55,13 @@ module Sentry
|
|
26
55
|
|
27
56
|
private
|
28
57
|
|
58
|
+
def set_sentry_trace_header(req)
|
59
|
+
return unless @sentry_span
|
60
|
+
|
61
|
+
trace = Sentry.get_current_client.generate_sentry_trace(@sentry_span)
|
62
|
+
req[SENTRY_TRACE_HEADER_NAME] = trace if trace
|
63
|
+
end
|
64
|
+
|
29
65
|
def record_sentry_breadcrumb(req, res)
|
30
66
|
if Sentry.initialized? && Sentry.configuration.breadcrumbs_logger.include?(:http_logger)
|
31
67
|
return if from_sentry_sdk?
|
@@ -71,8 +107,8 @@ module Sentry
|
|
71
107
|
end
|
72
108
|
|
73
109
|
def from_sentry_sdk?
|
74
|
-
|
75
|
-
|
110
|
+
dsn = Sentry.configuration.dsn
|
111
|
+
dsn && dsn.host == self.address
|
76
112
|
end
|
77
113
|
|
78
114
|
def extract_request_info(req)
|
data/lib/sentry/rack.rb
CHANGED
data/lib/sentry/rake.rb
CHANGED
@@ -9,7 +9,7 @@ module Rake
|
|
9
9
|
task_name = top_level_tasks.join(' ')
|
10
10
|
scope.set_transaction_name(task_name)
|
11
11
|
scope.set_tag("rake_task", task_name)
|
12
|
-
end if Sentry.initialized?
|
12
|
+
end if Sentry.initialized? && !Sentry.configuration.skip_rake_integration
|
13
13
|
|
14
14
|
orig_display_error_messsage(ex)
|
15
15
|
end
|
data/lib/sentry/transport.rb
CHANGED
data/lib/sentry/version.rb
CHANGED
data/sentry-ruby-core.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
18
|
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
-
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/
|
19
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
20
20
|
|
21
21
|
spec.bindir = "exe"
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
data/sentry-ruby.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
|
16
16
|
spec.metadata["homepage_uri"] = spec.homepage
|
17
17
|
spec.metadata["source_code_uri"] = spec.homepage
|
18
|
-
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/
|
18
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
19
19
|
|
20
20
|
spec.add_dependency "sentry-ruby-core", Sentry::VERSION
|
21
21
|
spec.add_dependency "faraday", ">= 1.0"
|
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.
|
4
|
+
version: 4.5.2
|
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-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -46,7 +46,6 @@ extra_rdoc_files:
|
|
46
46
|
- README.md
|
47
47
|
- LICENSE.txt
|
48
48
|
files:
|
49
|
-
- ".craft.yml"
|
50
49
|
- ".gitignore"
|
51
50
|
- ".rspec"
|
52
51
|
- CHANGELOG.md
|
@@ -61,7 +60,6 @@ files:
|
|
61
60
|
- lib/sentry-ruby.rb
|
62
61
|
- lib/sentry/background_worker.rb
|
63
62
|
- lib/sentry/backtrace.rb
|
64
|
-
- lib/sentry/benchmarks/benchmark_transport.rb
|
65
63
|
- lib/sentry/breadcrumb.rb
|
66
64
|
- lib/sentry/breadcrumb/sentry_logger.rb
|
67
65
|
- lib/sentry/breadcrumb_buffer.rb
|
@@ -86,7 +84,6 @@ files:
|
|
86
84
|
- lib/sentry/net/http.rb
|
87
85
|
- lib/sentry/rack.rb
|
88
86
|
- lib/sentry/rack/capture_exceptions.rb
|
89
|
-
- lib/sentry/rack/deprecations.rb
|
90
87
|
- lib/sentry/rake.rb
|
91
88
|
- lib/sentry/scope.rb
|
92
89
|
- lib/sentry/span.rb
|
@@ -110,7 +107,7 @@ licenses:
|
|
110
107
|
metadata:
|
111
108
|
homepage_uri: https://github.com/getsentry/sentry-ruby
|
112
109
|
source_code_uri: https://github.com/getsentry/sentry-ruby
|
113
|
-
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/master/
|
110
|
+
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md
|
114
111
|
post_install_message:
|
115
112
|
rdoc_options: []
|
116
113
|
require_paths:
|
@@ -126,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
123
|
- !ruby/object:Gem::Version
|
127
124
|
version: '0'
|
128
125
|
requirements: []
|
129
|
-
rubygems_version: 3.
|
126
|
+
rubygems_version: 3.1.6
|
130
127
|
signing_key:
|
131
128
|
specification_version: 4
|
132
129
|
summary: A gem that provides a client interface for the Sentry error logger
|
data/.craft.yml
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
minVersion: '0.13.2'
|
2
|
-
github:
|
3
|
-
owner: getsentry
|
4
|
-
repo: sentry-ruby
|
5
|
-
changelogPolicy: simple
|
6
|
-
preReleaseCommand: ruby ../.scripts/bump-version.rb
|
7
|
-
releaseBranchPrefix: release-sentry-ruby
|
8
|
-
statusProvider:
|
9
|
-
name: github
|
10
|
-
artifactProvider:
|
11
|
-
name: github
|
12
|
-
targets:
|
13
|
-
# we always need to make sure sentry-ruby-core is present when pushing to any target
|
14
|
-
- name: gem
|
15
|
-
onlyIfPresent: /^sentry-ruby-core-\d.*\.gem$/
|
16
|
-
- name: registry
|
17
|
-
onlyIfPresent: /^sentry-ruby-core-\d.*\.gem$/
|
18
|
-
type: sdk
|
19
|
-
config:
|
20
|
-
canonical: 'gem:sentry-ruby'
|
21
|
-
- name: registry
|
22
|
-
onlyIfPresent: /^sentry-ruby-core-\d.*\.gem$/
|
23
|
-
type: sdk
|
24
|
-
config:
|
25
|
-
canonical: 'gem:sentry-ruby-core'
|
26
|
-
- name: github
|
27
|
-
onlyIfPresent: /^sentry-ruby-core-\d.*\.gem$/
|
28
|
-
tagPrefix: sentry-ruby-v
|
29
|
-
changelog: sentry-ruby/CHANGELOG.md
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Sentry
|
2
|
-
module Rack
|
3
|
-
class DeprecatedMiddleware
|
4
|
-
def initialize(_)
|
5
|
-
raise Sentry::Error.new <<~MSG
|
6
|
-
|
7
|
-
You're seeing this message because #{self.class} has been replaced by Sentry::Rack::CaptureExceptions.
|
8
|
-
Removing this middleware from your app and upgrading sentry-rails to 4.1.0+ should solve the issue.
|
9
|
-
MSG
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class Tracing < DeprecatedMiddleware
|
14
|
-
end
|
15
|
-
|
16
|
-
class CaptureException < DeprecatedMiddleware
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|