sentry-ruby-core 5.9.0 → 5.10.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 +4 -4
- data/Gemfile +5 -2
- data/lib/sentry/configuration.rb +39 -13
- data/lib/sentry/hub.rb +5 -1
- data/lib/sentry/net/http.rb +5 -2
- data/lib/sentry/redis.rb +1 -0
- data/lib/sentry/utils/argument_checking_helper.rb +3 -3
- data/lib/sentry/version.rb +1 -1
- metadata +4 -5
- data/CODE_OF_CONDUCT.md +0 -74
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e70916ec6385aa4a3aa3b7a7581c4c641076bb71eab38effea7cb1640c9b582a
|
4
|
+
data.tar.gz: 943213fc7484da3a08692dd525d52cafbfff60dacead8373627765d1ba05120f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0f5fa06a98c566aff53a89e1169cb40b148faf7a8ed90c5df2d7d38481f0f8ace365dc4d51359616ccbafb6920a6794ddf79490026c3306a4b38656a09b6ec4
|
7
|
+
data.tar.gz: 3ddaa6472d696a19dd9cc97bb7fb259ecff49d36da7e8dbff65cebdf2fc62bdf95da54a92c2ee8f32ab5206044a7306842946c5fde7e0fa365c4c5b282c9fb49
|
data/Gemfile
CHANGED
@@ -21,8 +21,11 @@ gem "simplecov-cobertura", "~> 1.4"
|
|
21
21
|
gem "rexml"
|
22
22
|
gem "stackprof" unless RUBY_PLATFORM == "java"
|
23
23
|
|
24
|
-
|
25
|
-
gem "debug", github: "ruby/debug", platform: :ruby
|
24
|
+
if RUBY_VERSION.to_f >= 2.6
|
25
|
+
gem "debug", github: "ruby/debug", platform: :ruby
|
26
|
+
gem "irb"
|
27
|
+
end
|
28
|
+
|
26
29
|
gem "pry"
|
27
30
|
|
28
31
|
gem "benchmark-ips"
|
data/lib/sentry/configuration.rb
CHANGED
@@ -14,6 +14,8 @@ module Sentry
|
|
14
14
|
class Configuration
|
15
15
|
include CustomInspection
|
16
16
|
include LoggingHelper
|
17
|
+
include ArgumentCheckingHelper
|
18
|
+
|
17
19
|
# Directories to be recognized as part of your app. e.g. if you
|
18
20
|
# have an `engines` dir at the root of your project, you may want
|
19
21
|
# to set this to something like /(app|config|engines|lib)/
|
@@ -179,7 +181,7 @@ module Sentry
|
|
179
181
|
# Release tag to be passed with every event sent to Sentry.
|
180
182
|
# We automatically try to set this to a git SHA or Capistrano release.
|
181
183
|
# @return [String]
|
182
|
-
|
184
|
+
attr_reader :release
|
183
185
|
|
184
186
|
# The sampling factor to apply to events. A value of 0.0 will not send
|
185
187
|
# any events, and a value of 1.0 will send 100% of events.
|
@@ -214,8 +216,8 @@ module Sentry
|
|
214
216
|
attr_reader :transport
|
215
217
|
|
216
218
|
# Take a float between 0.0 and 1.0 as the sample rate for tracing events (transactions).
|
217
|
-
# @return [Float]
|
218
|
-
|
219
|
+
# @return [Float, nil]
|
220
|
+
attr_reader :traces_sample_rate
|
219
221
|
|
220
222
|
# Take a Proc that controls the sample rate for every tracing event, e.g.
|
221
223
|
# @example
|
@@ -255,6 +257,15 @@ module Sentry
|
|
255
257
|
# @!visibility private
|
256
258
|
attr_reader :errors, :gem_specs
|
257
259
|
|
260
|
+
# These exceptions could enter Puma's `lowlevel_error_handler` callback and the SDK's Puma integration
|
261
|
+
# But they are mostly considered as noise and should be ignored by default
|
262
|
+
# Please see https://github.com/getsentry/sentry-ruby/pull/2026 for more information
|
263
|
+
PUMA_IGNORE_DEFAULT = [
|
264
|
+
'Puma::MiniSSL::SSLError',
|
265
|
+
'Puma::HttpParserError',
|
266
|
+
'Puma::HttpParserError501'
|
267
|
+
].freeze
|
268
|
+
|
258
269
|
# Most of these errors generate 4XX responses. In general, Sentry clients
|
259
270
|
# only automatically report 5xx responses.
|
260
271
|
IGNORE_DEFAULT = [
|
@@ -304,7 +315,7 @@ module Sentry
|
|
304
315
|
self.environment = environment_from_env
|
305
316
|
self.enabled_environments = []
|
306
317
|
self.exclude_loggers = []
|
307
|
-
self.excluded_exceptions = IGNORE_DEFAULT
|
318
|
+
self.excluded_exceptions = IGNORE_DEFAULT + PUMA_IGNORE_DEFAULT
|
308
319
|
self.inspect_exception_causes_for_exclusion = true
|
309
320
|
self.linecache = ::Sentry::LineCache.new
|
310
321
|
self.logger = ::Sentry::Logger.new(STDOUT)
|
@@ -325,7 +336,6 @@ module Sentry
|
|
325
336
|
self.before_send = nil
|
326
337
|
self.before_send_transaction = nil
|
327
338
|
self.rack_env_whitelist = RACK_ENV_WHITELIST_DEFAULT
|
328
|
-
self.traces_sample_rate = nil
|
329
339
|
self.traces_sampler = nil
|
330
340
|
self.enable_tracing = nil
|
331
341
|
|
@@ -341,6 +351,12 @@ module Sentry
|
|
341
351
|
|
342
352
|
alias server= dsn=
|
343
353
|
|
354
|
+
def release=(value)
|
355
|
+
check_argument_type!(value, String, NilClass)
|
356
|
+
|
357
|
+
@release = value
|
358
|
+
end
|
359
|
+
|
344
360
|
def async=(value)
|
345
361
|
check_callable!("async", value)
|
346
362
|
|
@@ -401,7 +417,17 @@ module Sentry
|
|
401
417
|
@traces_sample_rate ||= 1.0 if enable_tracing
|
402
418
|
end
|
403
419
|
|
420
|
+
def is_numeric_or_nil?(value)
|
421
|
+
value.is_a?(Numeric) || value.nil?
|
422
|
+
end
|
423
|
+
|
424
|
+
def traces_sample_rate=(traces_sample_rate)
|
425
|
+
raise ArgumentError, "traces_sample_rate must be a Numeric or nil" unless is_numeric_or_nil?(traces_sample_rate)
|
426
|
+
@traces_sample_rate = traces_sample_rate
|
427
|
+
end
|
428
|
+
|
404
429
|
def profiles_sample_rate=(profiles_sample_rate)
|
430
|
+
raise ArgumentError, "profiles_sample_rate must be a Numeric or nil" unless is_numeric_or_nil?(profiles_sample_rate)
|
405
431
|
log_info("Please make sure to include the 'stackprof' gem in your Gemfile to use Profiling with Sentry.") unless defined?(StackProf)
|
406
432
|
@profiles_sample_rate = profiles_sample_rate
|
407
433
|
end
|
@@ -435,19 +461,19 @@ module Sentry
|
|
435
461
|
enabled_environments.empty? || enabled_environments.include?(environment)
|
436
462
|
end
|
437
463
|
|
464
|
+
def valid_sample_rate?(sample_rate)
|
465
|
+
return false unless sample_rate.is_a?(Numeric)
|
466
|
+
sample_rate >= 0.0 && sample_rate <= 1.0
|
467
|
+
end
|
468
|
+
|
438
469
|
def tracing_enabled?
|
439
|
-
valid_sampler = !!((@traces_sample_rate
|
440
|
-
@traces_sample_rate >= 0.0 &&
|
441
|
-
@traces_sample_rate <= 1.0) ||
|
442
|
-
@traces_sampler)
|
470
|
+
valid_sampler = !!((valid_sample_rate?(@traces_sample_rate)) || @traces_sampler)
|
443
471
|
|
444
472
|
(@enable_tracing != false) && valid_sampler && sending_allowed?
|
445
473
|
end
|
446
474
|
|
447
475
|
def profiling_enabled?
|
448
|
-
valid_sampler = !!(@profiles_sample_rate
|
449
|
-
@profiles_sample_rate >= 0.0 &&
|
450
|
-
@profiles_sample_rate <= 1.0)
|
476
|
+
valid_sampler = !!(valid_sample_rate?(@profiles_sample_rate))
|
451
477
|
|
452
478
|
tracing_enabled? && valid_sampler && sending_allowed?
|
453
479
|
end
|
@@ -477,7 +503,7 @@ module Sentry
|
|
477
503
|
def detect_release
|
478
504
|
return unless sending_allowed?
|
479
505
|
|
480
|
-
|
506
|
+
@release ||= ReleaseDetector.detect_release(project_root: project_root, running_on_heroku: running_on_heroku?)
|
481
507
|
|
482
508
|
if running_on_heroku? && release.nil?
|
483
509
|
log_warn(HEROKU_DYNO_METADATA_MESSAGE)
|
data/lib/sentry/hub.rb
CHANGED
@@ -116,7 +116,11 @@ module Sentry
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def capture_exception(exception, **options, &block)
|
119
|
-
|
119
|
+
if RUBY_PLATFORM == "java"
|
120
|
+
check_argument_type!(exception, ::Exception, ::Java::JavaLang::Throwable)
|
121
|
+
else
|
122
|
+
check_argument_type!(exception, ::Exception)
|
123
|
+
end
|
120
124
|
|
121
125
|
return if Sentry.exception_captured?(exception)
|
122
126
|
|
data/lib/sentry/net/http.rb
CHANGED
@@ -38,7 +38,10 @@ module Sentry
|
|
38
38
|
if sentry_span
|
39
39
|
request_info = extract_request_info(req)
|
40
40
|
sentry_span.set_description("#{request_info[:method]} #{request_info[:url]}")
|
41
|
-
sentry_span.set_data(
|
41
|
+
sentry_span.set_data('url', request_info[:url])
|
42
|
+
sentry_span.set_data('http.method', request_info[:method])
|
43
|
+
sentry_span.set_data('http.query', request_info[:query]) if request_info[:query]
|
44
|
+
sentry_span.set_data('status', res.code.to_i)
|
42
45
|
end
|
43
46
|
end
|
44
47
|
end
|
@@ -87,7 +90,7 @@ module Sentry
|
|
87
90
|
result = { method: req.method, url: url }
|
88
91
|
|
89
92
|
if Sentry.configuration.send_default_pii
|
90
|
-
result[:
|
93
|
+
result[:query] = uri.query
|
91
94
|
result[:body] = req.body
|
92
95
|
end
|
93
96
|
|
data/lib/sentry/redis.rb
CHANGED
@@ -4,9 +4,9 @@ module Sentry
|
|
4
4
|
module ArgumentCheckingHelper
|
5
5
|
private
|
6
6
|
|
7
|
-
def check_argument_type!(argument,
|
8
|
-
unless argument.is_a?(
|
9
|
-
raise ArgumentError, "expect the argument to be a #{
|
7
|
+
def check_argument_type!(argument, *expected_types)
|
8
|
+
unless expected_types.any? { |t| argument.is_a?(t) }
|
9
|
+
raise ArgumentError, "expect the argument to be a #{expected_types.join(' or ')}, got #{argument.class} (#{argument.inspect})"
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
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: 5.
|
4
|
+
version: 5.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sentry Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04
|
11
|
+
date: 2023-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sentry-ruby
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 5.
|
19
|
+
version: 5.10.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 5.
|
26
|
+
version: 5.10.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: concurrent-ruby
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,7 +50,6 @@ files:
|
|
50
50
|
- ".rspec"
|
51
51
|
- ".yardopts"
|
52
52
|
- CHANGELOG.md
|
53
|
-
- CODE_OF_CONDUCT.md
|
54
53
|
- Gemfile
|
55
54
|
- LICENSE.txt
|
56
55
|
- Makefile
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at stan001212@gmail.com. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: https://contributor-covenant.org
|
74
|
-
[version]: https://contributor-covenant.org/version/1/4/
|