sentry-ruby-core 4.8.1 → 4.8.3
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/.yardopts +2 -0
- data/Gemfile +2 -0
- data/lib/sentry/backtrace.rb +1 -0
- data/lib/sentry/configuration.rb +83 -39
- data/lib/sentry/envelope.rb +1 -0
- data/lib/sentry/linecache.rb +1 -0
- data/lib/sentry/net/http.rb +1 -0
- data/lib/sentry/rake.rb +12 -2
- data/lib/sentry/release_detector.rb +1 -0
- data/lib/sentry/version.rb +1 -1
- data/lib/sentry-ruby.rb +76 -28
- data/sentry-ruby.gemspec +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b41956862e17f8b60319bac7a72b253889aad50b0518b4dd119bcc5da246c2c
|
4
|
+
data.tar.gz: 8e37db5f09d89bf1382e89744ae2a4c3a5112d4d0a5aa3f105b754974cb5d1a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9603b5d16ee470d52fa2052a7f9156c7a2e709d906e7299e661648bec6ab56b1c076de19c8b9ea37a97dafc0f21f59dc12898e2b1bde02d14de4e725d5aa1120
|
7
|
+
data.tar.gz: 2c511329f550a6d9c495b55d9e40731d55e953ffc9632dcdcbfcc88266edc95287fc7d912161b853421ec0e281e9dc6dc1574d4523939b92d1c08cca569e7185
|
data/.yardopts
ADDED
data/Gemfile
CHANGED
data/lib/sentry/backtrace.rb
CHANGED
data/lib/sentry/configuration.rb
CHANGED
@@ -17,10 +17,15 @@ module Sentry
|
|
17
17
|
# Directories to be recognized as part of your app. e.g. if you
|
18
18
|
# have an `engines` dir at the root of your project, you may want
|
19
19
|
# to set this to something like /(app|config|engines|lib)/
|
20
|
+
#
|
21
|
+
# @return [Regexp, nil]
|
20
22
|
attr_accessor :app_dirs_pattern
|
21
23
|
|
22
24
|
# Provide an object that responds to `call` to send events asynchronously.
|
23
25
|
# E.g.: lambda { |event| Thread.new { Sentry.send_event(event) } }
|
26
|
+
#
|
27
|
+
# @deprecated It will be removed in the next major release. Please read https://github.com/getsentry/sentry-ruby/issues/1522 for more information
|
28
|
+
# @return [Proc, nil]
|
24
29
|
attr_reader :async
|
25
30
|
|
26
31
|
# to send events in a non-blocking way, sentry-ruby has its own background worker
|
@@ -30,74 +35,94 @@ module Sentry
|
|
30
35
|
#
|
31
36
|
# if you want to send events synchronously, set the value to 0
|
32
37
|
# E.g.: config.background_worker_threads = 0
|
38
|
+
# @return [Integer]
|
33
39
|
attr_accessor :background_worker_threads
|
34
40
|
|
35
41
|
# a proc/lambda that takes an array of stack traces
|
36
42
|
# it'll be used to silence (reduce) backtrace of the exception
|
37
43
|
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
# Rails.backtrace_cleaner.clean(backtrace)
|
43
|
-
# end
|
44
|
-
# ```
|
44
|
+
# @example
|
45
|
+
# config.backtrace_cleanup_callback = lambda do |backtrace|
|
46
|
+
# Rails.backtrace_cleaner.clean(backtrace)
|
47
|
+
# end
|
45
48
|
#
|
49
|
+
# @return [Proc]
|
46
50
|
attr_accessor :backtrace_cleanup_callback
|
47
51
|
|
48
52
|
# Optional Proc, called before adding the breadcrumb to the current scope
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
53
|
+
# @example
|
54
|
+
# config.before = lambda do |breadcrumb, hint|
|
55
|
+
# breadcrumb.message = 'a'
|
56
|
+
# breadcrumb
|
57
|
+
# end
|
58
|
+
# @return [Proc]
|
55
59
|
attr_reader :before_breadcrumb
|
56
60
|
|
57
|
-
# Optional Proc, called before sending an event to the server
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
61
|
+
# Optional Proc, called before sending an event to the server
|
62
|
+
# @example
|
63
|
+
# config.before_send = lambda do |event, hint|
|
64
|
+
# # skip ZeroDivisionError exceptions
|
65
|
+
# # note: hint[:exception] would be a String if you use async callback
|
66
|
+
# if hint[:exception].is_a?(ZeroDivisionError)
|
67
|
+
# nil
|
68
|
+
# else
|
69
|
+
# event
|
70
|
+
# end
|
71
|
+
# end
|
72
|
+
# @return [Proc]
|
64
73
|
attr_reader :before_send
|
65
74
|
|
66
75
|
# An array of breadcrumbs loggers to be used. Available options are:
|
67
76
|
# - :sentry_logger
|
77
|
+
# - :http_logger
|
78
|
+
#
|
79
|
+
# And if you also use sentry-rails:
|
68
80
|
# - :active_support_logger
|
81
|
+
# - :monotonic_active_support_logger
|
82
|
+
#
|
83
|
+
# @return [Array<Symbol>]
|
69
84
|
attr_reader :breadcrumbs_logger
|
70
85
|
|
71
86
|
# Whether to capture local variables from the raised exception's frame. Default is false.
|
87
|
+
# @return [Boolean]
|
72
88
|
attr_accessor :capture_exception_frame_locals
|
73
89
|
|
74
90
|
# Max number of breadcrumbs a breadcrumb buffer can hold
|
91
|
+
# @return [Integer]
|
75
92
|
attr_accessor :max_breadcrumbs
|
76
93
|
|
77
94
|
# Number of lines of code context to capture, or nil for none
|
95
|
+
# @return [Integer, nil]
|
78
96
|
attr_accessor :context_lines
|
79
97
|
|
80
98
|
# RACK_ENV by default.
|
99
|
+
# @return [String]
|
81
100
|
attr_reader :environment
|
82
101
|
|
83
102
|
# Whether the SDK should run in the debugging mode. Default is false.
|
84
103
|
# If set to true, SDK errors will be logged with backtrace
|
104
|
+
# @return [Boolean]
|
85
105
|
attr_accessor :debug
|
86
106
|
|
87
107
|
# the dsn value, whether it's set via `config.dsn=` or `ENV["SENTRY_DSN"]`
|
108
|
+
# @return [String]
|
88
109
|
attr_reader :dsn
|
89
110
|
|
90
111
|
# Whitelist of enabled_environments that will send notifications to Sentry. Array of Strings.
|
112
|
+
# @return [Array<String>]
|
91
113
|
attr_accessor :enabled_environments
|
92
114
|
|
93
115
|
# Logger 'progname's to exclude from breadcrumbs
|
116
|
+
# @return [Array<String>]
|
94
117
|
attr_accessor :exclude_loggers
|
95
118
|
|
96
119
|
# Array of exception classes that should never be sent. See IGNORE_DEFAULT.
|
97
120
|
# You should probably append to this rather than overwrite it.
|
121
|
+
# @return [Array<String>]
|
98
122
|
attr_accessor :excluded_exceptions
|
99
123
|
|
100
124
|
# Boolean to check nested exceptions when deciding if to exclude. Defaults to true
|
125
|
+
# @return [Boolean]
|
101
126
|
attr_accessor :inspect_exception_causes_for_exclusion
|
102
127
|
alias inspect_exception_causes_for_exclusion? inspect_exception_causes_for_exclusion
|
103
128
|
|
@@ -108,65 +133,80 @@ module Sentry
|
|
108
133
|
|
109
134
|
# Logger used by Sentry. In Rails, this is the Rails logger, otherwise
|
110
135
|
# Sentry provides its own Sentry::Logger.
|
136
|
+
# @return [Logger]
|
111
137
|
attr_accessor :logger
|
112
138
|
|
113
139
|
# Project directory root for in_app detection. Could be Rails root, etc.
|
114
140
|
# Set automatically for Rails.
|
141
|
+
# @return [String]
|
115
142
|
attr_accessor :project_root
|
116
143
|
|
117
144
|
# Insert sentry-trace to outgoing requests' headers
|
145
|
+
# @return [Boolean]
|
118
146
|
attr_accessor :propagate_traces
|
119
147
|
|
120
148
|
# Array of rack env parameters to be included in the event sent to sentry.
|
149
|
+
# @return [Array<String>]
|
121
150
|
attr_accessor :rack_env_whitelist
|
122
151
|
|
123
152
|
# Release tag to be passed with every event sent to Sentry.
|
124
153
|
# We automatically try to set this to a git SHA or Capistrano release.
|
154
|
+
# @return [String]
|
125
155
|
attr_accessor :release
|
126
156
|
|
127
157
|
# The sampling factor to apply to events. A value of 0.0 will not send
|
128
158
|
# any events, and a value of 1.0 will send 100% of events.
|
159
|
+
# @return [Float]
|
129
160
|
attr_accessor :sample_rate
|
130
161
|
|
131
162
|
# Include module versions in reports - boolean.
|
163
|
+
# @return [Boolean]
|
132
164
|
attr_accessor :send_modules
|
133
165
|
|
134
166
|
# When send_default_pii's value is false (default), sensitive information like
|
135
167
|
# - user ip
|
136
168
|
# - user cookie
|
137
169
|
# - request body
|
170
|
+
# - query string
|
138
171
|
# will not be sent to Sentry.
|
172
|
+
# @return [Boolean]
|
139
173
|
attr_accessor :send_default_pii
|
140
174
|
|
141
175
|
# Allow to skip Sentry emails within rake tasks
|
176
|
+
# @return [Boolean]
|
142
177
|
attr_accessor :skip_rake_integration
|
143
178
|
|
144
179
|
# IP ranges for trusted proxies that will be skipped when calculating IP address.
|
145
180
|
attr_accessor :trusted_proxies
|
146
181
|
|
182
|
+
# @return [String]
|
147
183
|
attr_accessor :server_name
|
148
184
|
|
149
185
|
# Return a Transport::Configuration object for transport-related configurations.
|
186
|
+
# @return [Transport]
|
150
187
|
attr_reader :transport
|
151
188
|
|
152
189
|
# Take a float between 0.0 and 1.0 as the sample rate for tracing events (transactions).
|
190
|
+
# @return [Float]
|
153
191
|
attr_accessor :traces_sample_rate
|
154
192
|
|
155
193
|
# Take a Proc that controls the sample rate for every tracing event, e.g.
|
156
|
-
#
|
157
|
-
# lambda do |tracing_context|
|
158
|
-
#
|
159
|
-
#
|
160
|
-
#
|
161
|
-
#
|
162
|
-
#
|
194
|
+
# @example
|
195
|
+
# config.traces_sampler = lambda do |tracing_context|
|
196
|
+
# # tracing_context[:transaction_context] contains the information about the transaction
|
197
|
+
# # tracing_context[:parent_sampled] contains the transaction's parent's sample decision
|
198
|
+
# true # return value can be a boolean or a float between 0.0 and 1.0
|
199
|
+
# end
|
200
|
+
# @return [Proc]
|
163
201
|
attr_accessor :traces_sampler
|
164
202
|
|
165
203
|
# Send diagnostic client reports about dropped events, true by default
|
166
204
|
# tries to attach to an existing envelope max once every 30s
|
205
|
+
# @return [Boolean]
|
167
206
|
attr_accessor :send_client_reports
|
168
207
|
|
169
208
|
# these are not config options
|
209
|
+
# @!visibility private
|
170
210
|
attr_reader :errors, :gem_specs
|
171
211
|
|
172
212
|
# Most of these errors generate 4XX responses. In general, Sentry clients
|
@@ -287,11 +327,6 @@ module Sentry
|
|
287
327
|
Random.rand < sample_rate
|
288
328
|
end
|
289
329
|
|
290
|
-
def error_messages
|
291
|
-
@errors = [@errors[0]] + @errors[1..-1].map(&:downcase) # fix case of all but first
|
292
|
-
@errors.join(", ")
|
293
|
-
end
|
294
|
-
|
295
330
|
def exception_class_allowed?(exc)
|
296
331
|
if exc.is_a?(Sentry::Error)
|
297
332
|
# Try to prevent error reporting loops
|
@@ -313,6 +348,17 @@ module Sentry
|
|
313
348
|
!!((@traces_sample_rate && @traces_sample_rate >= 0.0 && @traces_sample_rate <= 1.0) || @traces_sampler) && sending_allowed?
|
314
349
|
end
|
315
350
|
|
351
|
+
# @return [String, nil]
|
352
|
+
def csp_report_uri
|
353
|
+
if dsn && dsn.valid?
|
354
|
+
uri = dsn.csp_report_uri
|
355
|
+
uri += "&sentry_release=#{CGI.escape(release)}" if release && !release.empty?
|
356
|
+
uri += "&sentry_environment=#{CGI.escape(environment)}" if environment && !environment.empty?
|
357
|
+
uri
|
358
|
+
end
|
359
|
+
end
|
360
|
+
|
361
|
+
# @api private
|
316
362
|
def stacktrace_builder
|
317
363
|
@stacktrace_builder ||= StacktraceBuilder.new(
|
318
364
|
project_root: @project_root.to_s,
|
@@ -323,6 +369,7 @@ module Sentry
|
|
323
369
|
)
|
324
370
|
end
|
325
371
|
|
372
|
+
# @api private
|
326
373
|
def detect_release
|
327
374
|
return unless sending_allowed?
|
328
375
|
|
@@ -335,13 +382,10 @@ module Sentry
|
|
335
382
|
log_error("Error detecting release", e, debug: debug)
|
336
383
|
end
|
337
384
|
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
uri += "&sentry_environment=#{CGI.escape(environment)}" if environment && !environment.empty?
|
343
|
-
uri
|
344
|
-
end
|
385
|
+
# @api private
|
386
|
+
def error_messages
|
387
|
+
@errors = [@errors[0]] + @errors[1..-1].map(&:downcase) # fix case of all but first
|
388
|
+
@errors.join(", ")
|
345
389
|
end
|
346
390
|
|
347
391
|
private
|
data/lib/sentry/envelope.rb
CHANGED
data/lib/sentry/linecache.rb
CHANGED
data/lib/sentry/net/http.rb
CHANGED
data/lib/sentry/rake.rb
CHANGED
@@ -6,6 +6,7 @@ require "rake/task"
|
|
6
6
|
module Sentry
|
7
7
|
module Rake
|
8
8
|
module Application
|
9
|
+
# @api private
|
9
10
|
def display_error_message(ex)
|
10
11
|
Sentry.capture_exception(ex) do |scope|
|
11
12
|
task_name = top_level_tasks.join(' ')
|
@@ -18,6 +19,7 @@ module Sentry
|
|
18
19
|
end
|
19
20
|
|
20
21
|
module Task
|
22
|
+
# @api private
|
21
23
|
def execute(args=nil)
|
22
24
|
return super unless Sentry.initialized? && Sentry.get_current_hub
|
23
25
|
|
@@ -27,5 +29,13 @@ module Sentry
|
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
30
|
-
|
31
|
-
Rake
|
32
|
+
# @api private
|
33
|
+
module Rake
|
34
|
+
class Application
|
35
|
+
prepend(Sentry::Rake::Application)
|
36
|
+
end
|
37
|
+
|
38
|
+
class Task
|
39
|
+
prepend(Sentry::Rake::Task)
|
40
|
+
end
|
41
|
+
end
|
data/lib/sentry/version.rb
CHANGED
data/lib/sentry-ruby.rb
CHANGED
@@ -39,6 +39,7 @@ module Sentry
|
|
39
39
|
THREAD_LOCAL = :sentry_hub
|
40
40
|
|
41
41
|
class << self
|
42
|
+
# @!visibility private
|
42
43
|
def exception_locals_tp
|
43
44
|
@exception_locals_tp ||= TracePoint.new(:raise) do |tp|
|
44
45
|
exception = tp.raised_exception
|
@@ -55,46 +56,60 @@ module Sentry
|
|
55
56
|
end
|
56
57
|
end
|
57
58
|
|
59
|
+
# @!attribute [rw] background_worker
|
60
|
+
# @return [BackgroundWorker]
|
58
61
|
attr_accessor :background_worker
|
59
62
|
|
60
63
|
##### Patch Registration #####
|
61
|
-
|
64
|
+
|
65
|
+
# @!visibility private
|
62
66
|
def register_patch(&block)
|
63
67
|
registered_patches << block
|
64
68
|
end
|
65
69
|
|
70
|
+
# @!visibility private
|
66
71
|
def apply_patches(config)
|
67
72
|
registered_patches.each do |patch|
|
68
73
|
patch.call(config)
|
69
74
|
end
|
70
75
|
end
|
71
76
|
|
77
|
+
# @!visibility private
|
72
78
|
def registered_patches
|
73
79
|
@registered_patches ||= []
|
74
80
|
end
|
75
81
|
|
76
82
|
##### Integrations #####
|
77
|
-
|
83
|
+
|
78
84
|
# Returns a hash that contains all the integrations that have been registered to the main SDK.
|
85
|
+
#
|
86
|
+
# @return [Hash{String=>Hash}]
|
79
87
|
def integrations
|
80
88
|
@integrations ||= {}
|
81
89
|
end
|
82
90
|
|
83
91
|
# Registers the SDK integration with its name and version.
|
92
|
+
#
|
93
|
+
# @param name [String] name of the integration
|
94
|
+
# @param version [String] version of the integration
|
84
95
|
def register_integration(name, version)
|
85
96
|
meta = { name: "sentry.ruby.#{name}", version: version }.freeze
|
86
97
|
integrations[name.to_s] = meta
|
87
98
|
end
|
88
99
|
|
89
100
|
##### Method Delegation #####
|
90
|
-
|
101
|
+
|
91
102
|
extend Forwardable
|
92
103
|
|
93
104
|
def_delegators :get_current_client, :configuration, :send_event
|
94
105
|
def_delegators :get_current_scope, :set_tags, :set_extras, :set_user, :set_context
|
95
106
|
|
96
107
|
##### Main APIs #####
|
108
|
+
|
109
|
+
# Initializes the SDK with given configuration.
|
97
110
|
#
|
111
|
+
# @yieldparam config [Configuration]
|
112
|
+
# @return [void]
|
98
113
|
def init(&block)
|
99
114
|
config = Configuration.new
|
100
115
|
yield(config) if block_given?
|
@@ -116,24 +131,36 @@ module Sentry
|
|
116
131
|
end
|
117
132
|
end
|
118
133
|
|
134
|
+
# Returns true if the SDK is initialized.
|
135
|
+
#
|
136
|
+
# @return [Boolean]
|
137
|
+
def initialized?
|
138
|
+
!!@main_hub
|
139
|
+
end
|
140
|
+
|
119
141
|
# Returns an uri for security policy reporting that's generated from the given DSN
|
120
142
|
# (To learn more about security policy reporting: https://docs.sentry.io/product/security-policy-reporting/)
|
121
143
|
#
|
122
144
|
# It returns nil if
|
145
|
+
# - The SDK is not initialized yet.
|
146
|
+
# - The DSN is not provided or is invalid.
|
123
147
|
#
|
124
|
-
#
|
125
|
-
# 2. The DSN is not provided or is invalid.
|
148
|
+
# @return [String, nil]
|
126
149
|
def csp_report_uri
|
127
150
|
return unless initialized?
|
128
151
|
configuration.csp_report_uri
|
129
152
|
end
|
130
153
|
|
131
154
|
# Returns the main thread's active hub.
|
155
|
+
#
|
156
|
+
# @return [Hub]
|
132
157
|
def get_main_hub
|
133
158
|
@main_hub
|
134
159
|
end
|
135
160
|
|
136
161
|
# Takes an instance of Sentry::Breadcrumb and stores it to the current active scope.
|
162
|
+
#
|
163
|
+
# @return [Breadcrumb, nil]
|
137
164
|
def add_breadcrumb(breadcrumb, **options)
|
138
165
|
get_current_hub&.add_breadcrumb(breadcrumb, **options)
|
139
166
|
end
|
@@ -141,6 +168,8 @@ module Sentry
|
|
141
168
|
# Returns the current active hub.
|
142
169
|
# If the current thread doesn't have an active hub, it will clone the main thread's active hub,
|
143
170
|
# stores it in the current thread, and then returns it.
|
171
|
+
#
|
172
|
+
# @return [Hub]
|
144
173
|
def get_current_hub
|
145
174
|
# we need to assign a hub to the current thread if it doesn't have one yet
|
146
175
|
#
|
@@ -151,85 +180,105 @@ module Sentry
|
|
151
180
|
end
|
152
181
|
|
153
182
|
# Returns the current active client.
|
183
|
+
# @return [Client, nil]
|
154
184
|
def get_current_client
|
155
185
|
get_current_hub&.current_client
|
156
186
|
end
|
157
187
|
|
158
188
|
# Returns the current active scope.
|
189
|
+
#
|
190
|
+
# @return [Scope, nil]
|
159
191
|
def get_current_scope
|
160
192
|
get_current_hub&.current_scope
|
161
193
|
end
|
162
194
|
|
163
195
|
# Clones the main thread's active hub and stores it to the current thread.
|
196
|
+
#
|
197
|
+
# @return [void]
|
164
198
|
def clone_hub_to_current_thread
|
165
199
|
Thread.current.thread_variable_set(THREAD_LOCAL, get_main_hub.clone)
|
166
200
|
end
|
167
201
|
|
168
202
|
# Takes a block and yields the current active scope.
|
169
203
|
#
|
170
|
-
#
|
171
|
-
#
|
172
|
-
#
|
173
|
-
#
|
204
|
+
# @example
|
205
|
+
# Sentry.configure_scope do |scope|
|
206
|
+
# scope.set_tags(foo: "bar")
|
207
|
+
# end
|
174
208
|
#
|
175
|
-
#
|
176
|
-
# ```
|
209
|
+
# Sentry.capture_message("test message") # this event will have tags { foo: "bar" }
|
177
210
|
#
|
211
|
+
# @yieldparam scope [Scope]
|
212
|
+
# @return [void]
|
178
213
|
def configure_scope(&block)
|
179
214
|
get_current_hub&.configure_scope(&block)
|
180
215
|
end
|
181
216
|
|
182
217
|
# Takes a block and yields a temporary scope.
|
183
218
|
# The temporary scope will inherit all the attributes from the current active scope and replace it to be the active
|
184
|
-
# scope inside the block.
|
219
|
+
# scope inside the block.
|
185
220
|
#
|
186
|
-
#
|
187
|
-
#
|
188
|
-
#
|
189
|
-
#
|
221
|
+
# @example
|
222
|
+
# Sentry.configure_scope do |scope|
|
223
|
+
# scope.set_tags(foo: "bar")
|
224
|
+
# end
|
190
225
|
#
|
191
|
-
#
|
226
|
+
# Sentry.capture_message("test message") # this event will have tags { foo: "bar" }
|
192
227
|
#
|
193
|
-
#
|
194
|
-
#
|
195
|
-
#
|
196
|
-
#
|
228
|
+
# Sentry.with_scope do |temp_scope|
|
229
|
+
# temp_scope.set_tags(foo: "baz")
|
230
|
+
# Sentry.capture_message("test message 2") # this event will have tags { foo: "baz" }
|
231
|
+
# end
|
197
232
|
#
|
198
|
-
#
|
199
|
-
# ```
|
233
|
+
# Sentry.capture_message("test message 3") # this event will have tags { foo: "bar" }
|
200
234
|
#
|
235
|
+
# @yieldparam scope [Scope]
|
236
|
+
# @return [void]
|
201
237
|
def with_scope(&block)
|
202
238
|
get_current_hub&.with_scope(&block)
|
203
239
|
end
|
204
240
|
|
205
241
|
# Takes an exception and reports it to Sentry via the currently active hub.
|
242
|
+
#
|
243
|
+
# @yieldparam scope [Scope]
|
244
|
+
# @return [Event, nil]
|
206
245
|
def capture_exception(exception, **options, &block)
|
207
246
|
get_current_hub&.capture_exception(exception, **options, &block)
|
208
247
|
end
|
209
248
|
|
210
249
|
# Takes a message string and reports it to Sentry via the currently active hub.
|
250
|
+
#
|
251
|
+
# @yieldparam scope [Scope]
|
252
|
+
# @return [Event, nil]
|
211
253
|
def capture_message(message, **options, &block)
|
212
254
|
get_current_hub&.capture_message(message, **options, &block)
|
213
255
|
end
|
214
256
|
|
215
257
|
# Takes an instance of Sentry::Event and dispatches it to the currently active hub.
|
258
|
+
#
|
259
|
+
# @return [Event, nil]
|
216
260
|
def capture_event(event)
|
217
261
|
get_current_hub&.capture_event(event)
|
218
262
|
end
|
219
263
|
|
220
264
|
# Takes or initializes a new Sentry::Transaction and makes a sampling decision for it.
|
265
|
+
#
|
266
|
+
# @return [Transaction, nil]
|
221
267
|
def start_transaction(**options)
|
222
268
|
get_current_hub&.start_transaction(**options)
|
223
269
|
end
|
224
270
|
|
225
271
|
# Returns the id of the lastly reported Sentry::Event.
|
272
|
+
#
|
273
|
+
# @return [String, nil]
|
226
274
|
def last_event_id
|
227
275
|
get_current_hub&.last_event_id
|
228
276
|
end
|
229
277
|
|
230
278
|
|
231
279
|
##### Helpers #####
|
232
|
-
|
280
|
+
|
281
|
+
# @!visibility private
|
233
282
|
def sys_command(command)
|
234
283
|
result = `#{command} 2>&1` rescue nil
|
235
284
|
return if result.nil? || result.empty? || ($CHILD_STATUS && $CHILD_STATUS.exitstatus != 0)
|
@@ -237,18 +286,17 @@ module Sentry
|
|
237
286
|
result.strip
|
238
287
|
end
|
239
288
|
|
240
|
-
|
241
|
-
!!@main_hub
|
242
|
-
end
|
243
|
-
|
289
|
+
# @!visibility private
|
244
290
|
def logger
|
245
291
|
configuration.logger
|
246
292
|
end
|
247
293
|
|
294
|
+
# @!visibility private
|
248
295
|
def sdk_meta
|
249
296
|
META
|
250
297
|
end
|
251
298
|
|
299
|
+
# @!visibility private
|
252
300
|
def utc_now
|
253
301
|
Time.now.utc
|
254
302
|
end
|
data/sentry-ruby.gemspec
CHANGED
@@ -18,6 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
19
19
|
|
20
20
|
spec.add_dependency "sentry-ruby-core", Sentry::VERSION
|
21
|
-
spec.add_dependency "faraday", "
|
21
|
+
spec.add_dependency "faraday", "~> 1.0"
|
22
22
|
spec.add_dependency "concurrent-ruby", '~> 1.0', '>= 1.0.2'
|
23
23
|
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.8.
|
4
|
+
version: 4.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sentry Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -48,6 +48,7 @@ extra_rdoc_files:
|
|
48
48
|
files:
|
49
49
|
- ".gitignore"
|
50
50
|
- ".rspec"
|
51
|
+
- ".yardopts"
|
51
52
|
- CHANGELOG.md
|
52
53
|
- CODE_OF_CONDUCT.md
|
53
54
|
- Gemfile
|