sentry-ruby 4.0.1 → 4.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ module Sentry
2
+ module ArgumentCheckingHelper
3
+ private
4
+
5
+ def check_argument_type!(argument, expected_type)
6
+ unless argument.is_a?(expected_type)
7
+ raise ArgumentError, "expect the argument to be a #{expected_type}, got #{argument.class} (#{argument.inspect})"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -4,9 +4,9 @@ module Sentry
4
4
  REQUEST_ID_HEADERS = %w(action_dispatch.request_id HTTP_X_REQUEST_ID).freeze
5
5
 
6
6
  # Request ID based on ActionDispatch::RequestId
7
- def self.read_from(env_hash)
7
+ def self.read_from(env)
8
8
  REQUEST_ID_HEADERS.each do |key|
9
- request_id = env_hash[key]
9
+ request_id = env[key]
10
10
  return request_id if request_id
11
11
  end
12
12
  nil
@@ -1,3 +1,3 @@
1
1
  module Sentry
2
- VERSION = "4.0.1"
2
+ VERSION = "4.1.4"
3
3
  end
@@ -23,4 +23,5 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ["lib"]
24
24
 
25
25
  spec.add_dependency "faraday", ">= 1.0"
26
+ spec.add_dependency "concurrent-ruby", '~> 1.0', '>= 1.0.2'
26
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentry-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.1.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: 2020-12-11 00:00:00.000000000 Z
11
+ date: 2021-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -24,6 +24,26 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: concurrent-ruby
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 1.0.2
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '1.0'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 1.0.2
27
47
  description: A gem that provides a client interface for the Sentry error logger
28
48
  email: accounts@sentry.io
29
49
  executables: []
@@ -45,6 +65,7 @@ files:
45
65
  - bin/console
46
66
  - bin/setup
47
67
  - lib/sentry-ruby.rb
68
+ - lib/sentry/background_worker.rb
48
69
  - lib/sentry/backtrace.rb
49
70
  - lib/sentry/benchmarks/benchmark_transport.rb
50
71
  - lib/sentry/breadcrumb.rb
@@ -57,6 +78,7 @@ files:
57
78
  - lib/sentry/dsn.rb
58
79
  - lib/sentry/event.rb
59
80
  - lib/sentry/hub.rb
81
+ - lib/sentry/integrable.rb
60
82
  - lib/sentry/interface.rb
61
83
  - lib/sentry/interfaces/exception.rb
62
84
  - lib/sentry/interfaces/request.rb
@@ -65,8 +87,8 @@ files:
65
87
  - lib/sentry/linecache.rb
66
88
  - lib/sentry/logger.rb
67
89
  - lib/sentry/rack.rb
68
- - lib/sentry/rack/capture_exception.rb
69
- - lib/sentry/rack/tracing.rb
90
+ - lib/sentry/rack/capture_exceptions.rb
91
+ - lib/sentry/rack/deprecations.rb
70
92
  - lib/sentry/rake.rb
71
93
  - lib/sentry/scope.rb
72
94
  - lib/sentry/span.rb
@@ -76,7 +98,7 @@ files:
76
98
  - lib/sentry/transport/configuration.rb
77
99
  - lib/sentry/transport/dummy_transport.rb
78
100
  - lib/sentry/transport/http_transport.rb
79
- - lib/sentry/transport/state.rb
101
+ - lib/sentry/utils/argument_checking_helper.rb
80
102
  - lib/sentry/utils/exception_cause_chain.rb
81
103
  - lib/sentry/utils/real_ip.rb
82
104
  - lib/sentry/utils/request_id.rb
@@ -1,45 +0,0 @@
1
- module Sentry
2
- module Rack
3
- class CaptureException
4
- def initialize(app)
5
- @app = app
6
- end
7
-
8
- def call(env)
9
- # this call clones the main (global) hub
10
- # and assigns it to the current thread's Sentry#get_current_hub
11
- # it's essential for multi-thread servers (e.g. puma)
12
- Sentry.clone_hub_to_current_thread unless Sentry.get_current_hub
13
- # this call creates an isolated scope for every request
14
- # it's essential for multi-process servers (e.g. unicorn)
15
- Sentry.with_scope do |scope|
16
- # there could be some breadcrumbs already stored in the top-level scope
17
- # and for request information, we don't need those breadcrumbs
18
- scope.clear_breadcrumbs
19
- env['sentry.client'] = Sentry.get_current_client
20
-
21
- scope.set_transaction_name(env["PATH_INFO"]) if env["PATH_INFO"]
22
- scope.set_rack_env(env)
23
-
24
- begin
25
- response = @app.call(env)
26
- rescue Sentry::Error
27
- raise # Don't capture Sentry errors
28
- rescue Exception => e
29
- Sentry.capture_exception(e)
30
- raise
31
- end
32
-
33
- exception = collect_exception(env)
34
- Sentry.capture_exception(exception) if exception
35
-
36
- response
37
- end
38
- end
39
-
40
- def collect_exception(env)
41
- env['rack.exception'] || env['sinatra.error']
42
- end
43
- end
44
- end
45
- end
@@ -1,39 +0,0 @@
1
- module Sentry
2
- module Rack
3
- class Tracing
4
- def initialize(app)
5
- @app = app
6
- end
7
-
8
- def call(env)
9
- Sentry.clone_hub_to_current_thread unless Sentry.get_current_hub
10
-
11
- if Sentry.configuration.traces_sample_rate.to_f == 0.0
12
- return @app.call(env)
13
- end
14
-
15
- Sentry.with_scope do |scope|
16
- scope.clear_breadcrumbs
17
- scope.set_transaction_name(env["PATH_INFO"]) if env["PATH_INFO"]
18
- span = Sentry.start_transaction(name: scope.transaction_name, op: "rack.request")
19
- scope.set_span(span)
20
-
21
- begin
22
- response = @app.call(env)
23
- rescue
24
- finish_span(span, 500)
25
- raise
26
- end
27
-
28
- finish_span(span, response[0])
29
- response
30
- end
31
- end
32
-
33
- def finish_span(span, status_code)
34
- span.set_http_status(status_code)
35
- span.finish
36
- end
37
- end
38
- end
39
- end
@@ -1,40 +0,0 @@
1
- module Sentry
2
- class Transport
3
- class State
4
- def initialize
5
- reset
6
- end
7
-
8
- def should_try?
9
- return true if @status == :online
10
-
11
- interval = @retry_after || [@retry_number, 6].min**2
12
- return true if Sentry.utc_now - @last_check >= interval
13
-
14
- false
15
- end
16
-
17
- def failure(retry_after = nil)
18
- @status = :error
19
- @retry_number += 1
20
- @last_check = Sentry.utc_now
21
- @retry_after = retry_after
22
- end
23
-
24
- def success
25
- reset
26
- end
27
-
28
- def reset
29
- @status = :online
30
- @retry_number = 0
31
- @last_check = nil
32
- @retry_after = nil
33
- end
34
-
35
- def failed?
36
- @status == :error
37
- end
38
- end
39
- end
40
- end