sentry-ruby 5.3.0 → 5.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.yardopts +2 -0
- data/CHANGELOG.md +313 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +31 -0
- data/Makefile +4 -0
- data/README.md +10 -6
- data/Rakefile +13 -0
- data/bin/console +18 -0
- data/bin/setup +8 -0
- data/lib/sentry/background_worker.rb +72 -0
- data/lib/sentry/backtrace.rb +124 -0
- data/lib/sentry/baggage.rb +81 -0
- data/lib/sentry/breadcrumb/sentry_logger.rb +90 -0
- data/lib/sentry/breadcrumb.rb +70 -0
- data/lib/sentry/breadcrumb_buffer.rb +64 -0
- data/lib/sentry/client.rb +207 -0
- data/lib/sentry/configuration.rb +543 -0
- data/lib/sentry/core_ext/object/deep_dup.rb +61 -0
- data/lib/sentry/core_ext/object/duplicable.rb +155 -0
- data/lib/sentry/dsn.rb +53 -0
- data/lib/sentry/envelope.rb +96 -0
- data/lib/sentry/error_event.rb +38 -0
- data/lib/sentry/event.rb +178 -0
- data/lib/sentry/exceptions.rb +9 -0
- data/lib/sentry/hub.rb +241 -0
- data/lib/sentry/integrable.rb +26 -0
- data/lib/sentry/interface.rb +16 -0
- data/lib/sentry/interfaces/exception.rb +43 -0
- data/lib/sentry/interfaces/request.rb +134 -0
- data/lib/sentry/interfaces/single_exception.rb +65 -0
- data/lib/sentry/interfaces/stacktrace.rb +87 -0
- data/lib/sentry/interfaces/stacktrace_builder.rb +79 -0
- data/lib/sentry/interfaces/threads.rb +42 -0
- data/lib/sentry/linecache.rb +47 -0
- data/lib/sentry/logger.rb +20 -0
- data/lib/sentry/net/http.rb +103 -0
- data/lib/sentry/rack/capture_exceptions.rb +82 -0
- data/lib/sentry/rack.rb +5 -0
- data/lib/sentry/rake.rb +41 -0
- data/lib/sentry/redis.rb +107 -0
- data/lib/sentry/release_detector.rb +39 -0
- data/lib/sentry/scope.rb +339 -0
- data/lib/sentry/session.rb +33 -0
- data/lib/sentry/session_flusher.rb +90 -0
- data/lib/sentry/span.rb +236 -0
- data/lib/sentry/test_helper.rb +78 -0
- data/lib/sentry/transaction.rb +345 -0
- data/lib/sentry/transaction_event.rb +53 -0
- data/lib/sentry/transport/configuration.rb +25 -0
- data/lib/sentry/transport/dummy_transport.rb +21 -0
- data/lib/sentry/transport/http_transport.rb +175 -0
- data/lib/sentry/transport.rb +214 -0
- data/lib/sentry/utils/argument_checking_helper.rb +13 -0
- data/lib/sentry/utils/custom_inspection.rb +14 -0
- data/lib/sentry/utils/encoding_helper.rb +22 -0
- data/lib/sentry/utils/exception_cause_chain.rb +20 -0
- data/lib/sentry/utils/logging_helper.rb +26 -0
- data/lib/sentry/utils/real_ip.rb +84 -0
- data/lib/sentry/utils/request_id.rb +18 -0
- data/lib/sentry/version.rb +5 -0
- data/lib/sentry-ruby.rb +511 -0
- data/sentry-ruby-core.gemspec +23 -0
- data/sentry-ruby.gemspec +24 -0
- metadata +66 -16
data/lib/sentry-ruby.rb
ADDED
@@ -0,0 +1,511 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "English"
|
4
|
+
require "forwardable"
|
5
|
+
require "time"
|
6
|
+
|
7
|
+
require "sentry/version"
|
8
|
+
require "sentry/exceptions"
|
9
|
+
require "sentry/core_ext/object/deep_dup"
|
10
|
+
require "sentry/utils/argument_checking_helper"
|
11
|
+
require "sentry/utils/encoding_helper"
|
12
|
+
require "sentry/utils/logging_helper"
|
13
|
+
require "sentry/configuration"
|
14
|
+
require "sentry/logger"
|
15
|
+
require "sentry/event"
|
16
|
+
require "sentry/error_event"
|
17
|
+
require "sentry/transaction_event"
|
18
|
+
require "sentry/span"
|
19
|
+
require "sentry/transaction"
|
20
|
+
require "sentry/hub"
|
21
|
+
require "sentry/background_worker"
|
22
|
+
require "sentry/session_flusher"
|
23
|
+
|
24
|
+
[
|
25
|
+
"sentry/rake",
|
26
|
+
"sentry/rack",
|
27
|
+
].each do |lib|
|
28
|
+
begin
|
29
|
+
require lib
|
30
|
+
rescue LoadError
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
module Sentry
|
35
|
+
META = { "name" => "sentry.ruby", "version" => Sentry::VERSION }.freeze
|
36
|
+
|
37
|
+
CAPTURED_SIGNATURE = :@__sentry_captured
|
38
|
+
|
39
|
+
LOGGER_PROGNAME = "sentry".freeze
|
40
|
+
|
41
|
+
SENTRY_TRACE_HEADER_NAME = "sentry-trace".freeze
|
42
|
+
|
43
|
+
BAGGAGE_HEADER_NAME = "baggage".freeze
|
44
|
+
|
45
|
+
THREAD_LOCAL = :sentry_hub
|
46
|
+
|
47
|
+
class << self
|
48
|
+
# @!visibility private
|
49
|
+
def exception_locals_tp
|
50
|
+
@exception_locals_tp ||= TracePoint.new(:raise) do |tp|
|
51
|
+
exception = tp.raised_exception
|
52
|
+
|
53
|
+
# don't collect locals again if the exception is re-raised
|
54
|
+
next if exception.instance_variable_get(:@sentry_locals)
|
55
|
+
next unless tp.binding
|
56
|
+
|
57
|
+
locals = tp.binding.local_variables.each_with_object({}) do |local, result|
|
58
|
+
result[local] = tp.binding.local_variable_get(local)
|
59
|
+
end
|
60
|
+
|
61
|
+
exception.instance_variable_set(:@sentry_locals, locals)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# @!attribute [rw] background_worker
|
66
|
+
# @return [BackgroundWorker, nil]
|
67
|
+
attr_accessor :background_worker
|
68
|
+
|
69
|
+
# @!attribute [r] session_flusher
|
70
|
+
# @return [SessionFlusher, nil]
|
71
|
+
attr_reader :session_flusher
|
72
|
+
|
73
|
+
##### Patch Registration #####
|
74
|
+
|
75
|
+
# @!visibility private
|
76
|
+
def register_patch(&block)
|
77
|
+
registered_patches << block
|
78
|
+
end
|
79
|
+
|
80
|
+
# @!visibility private
|
81
|
+
def apply_patches(config)
|
82
|
+
registered_patches.each do |patch|
|
83
|
+
patch.call(config)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# @!visibility private
|
88
|
+
def registered_patches
|
89
|
+
@registered_patches ||= []
|
90
|
+
end
|
91
|
+
|
92
|
+
##### Integrations #####
|
93
|
+
|
94
|
+
# Returns a hash that contains all the integrations that have been registered to the main SDK.
|
95
|
+
#
|
96
|
+
# @return [Hash{String=>Hash}]
|
97
|
+
def integrations
|
98
|
+
@integrations ||= {}
|
99
|
+
end
|
100
|
+
|
101
|
+
# Registers the SDK integration with its name and version.
|
102
|
+
#
|
103
|
+
# @param name [String] name of the integration
|
104
|
+
# @param version [String] version of the integration
|
105
|
+
def register_integration(name, version)
|
106
|
+
if initialized?
|
107
|
+
logger.warn(LOGGER_PROGNAME) do
|
108
|
+
<<~MSG
|
109
|
+
Integration '#{name}' is loaded after the SDK is initialized, which can cause unexpected behavior. Please make sure all integrations are loaded before SDK initialization.
|
110
|
+
MSG
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
meta = { name: "sentry.ruby.#{name}", version: version }.freeze
|
115
|
+
integrations[name.to_s] = meta
|
116
|
+
end
|
117
|
+
|
118
|
+
##### Method Delegation #####
|
119
|
+
|
120
|
+
extend Forwardable
|
121
|
+
|
122
|
+
# @!macro [new] configuration
|
123
|
+
# The Configuration object that's used for configuring the client and its transport.
|
124
|
+
# @return [Configuration]
|
125
|
+
# @!macro [new] send_event
|
126
|
+
# Sends the event to Sentry.
|
127
|
+
# @param event [Event] the event to be sent.
|
128
|
+
# @param hint [Hash] the hint data that'll be passed to `before_send` callback.
|
129
|
+
# @return [Event]
|
130
|
+
|
131
|
+
# @!method configuration
|
132
|
+
# @!macro configuration
|
133
|
+
def configuration
|
134
|
+
return unless initialized?
|
135
|
+
get_current_client.configuration
|
136
|
+
end
|
137
|
+
|
138
|
+
# @!method send_event
|
139
|
+
# @!macro send_event
|
140
|
+
def send_event(*args)
|
141
|
+
return unless initialized?
|
142
|
+
get_current_client.send_event(*args)
|
143
|
+
end
|
144
|
+
|
145
|
+
# @!macro [new] set_extras
|
146
|
+
# Updates the scope's extras attribute by merging with the old value.
|
147
|
+
# @param extras [Hash]
|
148
|
+
# @return [Hash]
|
149
|
+
# @!macro [new] set_user
|
150
|
+
# Sets the scope's user attribute.
|
151
|
+
# @param user [Hash]
|
152
|
+
# @return [Hash]
|
153
|
+
# @!macro [new] set_context
|
154
|
+
# Adds a new key-value pair to current contexts.
|
155
|
+
# @param key [String, Symbol]
|
156
|
+
# @param value [Object]
|
157
|
+
# @return [Hash]
|
158
|
+
# @!macro [new] set_tags
|
159
|
+
# Updates the scope's tags attribute by merging with the old value.
|
160
|
+
# @param tags [Hash]
|
161
|
+
# @return [Hash]
|
162
|
+
|
163
|
+
# @!method set_tags
|
164
|
+
# @!macro set_tags
|
165
|
+
def set_tags(*args)
|
166
|
+
return unless initialized?
|
167
|
+
get_current_scope.set_tags(*args)
|
168
|
+
end
|
169
|
+
|
170
|
+
# @!method set_extras
|
171
|
+
# @!macro set_extras
|
172
|
+
def set_extras(*args)
|
173
|
+
return unless initialized?
|
174
|
+
get_current_scope.set_extras(*args)
|
175
|
+
end
|
176
|
+
|
177
|
+
# @!method set_user
|
178
|
+
# @!macro set_user
|
179
|
+
def set_user(*args)
|
180
|
+
return unless initialized?
|
181
|
+
get_current_scope.set_user(*args)
|
182
|
+
end
|
183
|
+
|
184
|
+
# @!method set_context
|
185
|
+
# @!macro set_context
|
186
|
+
def set_context(*args)
|
187
|
+
return unless initialized?
|
188
|
+
get_current_scope.set_context(*args)
|
189
|
+
end
|
190
|
+
|
191
|
+
##### Main APIs #####
|
192
|
+
|
193
|
+
# Initializes the SDK with given configuration.
|
194
|
+
#
|
195
|
+
# @yieldparam config [Configuration]
|
196
|
+
# @return [void]
|
197
|
+
def init(&block)
|
198
|
+
config = Configuration.new
|
199
|
+
yield(config) if block_given?
|
200
|
+
config.detect_release
|
201
|
+
apply_patches(config)
|
202
|
+
client = Client.new(config)
|
203
|
+
scope = Scope.new(max_breadcrumbs: config.max_breadcrumbs)
|
204
|
+
hub = Hub.new(client, scope)
|
205
|
+
Thread.current.thread_variable_set(THREAD_LOCAL, hub)
|
206
|
+
@main_hub = hub
|
207
|
+
@background_worker = Sentry::BackgroundWorker.new(config)
|
208
|
+
|
209
|
+
@session_flusher = if config.auto_session_tracking
|
210
|
+
Sentry::SessionFlusher.new(config, client)
|
211
|
+
else
|
212
|
+
nil
|
213
|
+
end
|
214
|
+
|
215
|
+
if config.include_local_variables
|
216
|
+
exception_locals_tp.enable
|
217
|
+
end
|
218
|
+
|
219
|
+
at_exit { close }
|
220
|
+
end
|
221
|
+
|
222
|
+
# Flushes pending events and cleans up SDK state.
|
223
|
+
# SDK will stop sending events and all top-level APIs will be no-ops after this.
|
224
|
+
#
|
225
|
+
# @return [void]
|
226
|
+
def close
|
227
|
+
if @background_worker
|
228
|
+
@background_worker.shutdown
|
229
|
+
@background_worker = nil
|
230
|
+
end
|
231
|
+
|
232
|
+
if @session_flusher
|
233
|
+
@session_flusher.kill
|
234
|
+
@session_flusher = nil
|
235
|
+
end
|
236
|
+
|
237
|
+
if configuration&.include_local_variables
|
238
|
+
exception_locals_tp.disable
|
239
|
+
end
|
240
|
+
|
241
|
+
@main_hub = nil
|
242
|
+
Thread.current.thread_variable_set(THREAD_LOCAL, nil)
|
243
|
+
end
|
244
|
+
|
245
|
+
# Returns true if the SDK is initialized.
|
246
|
+
#
|
247
|
+
# @return [Boolean]
|
248
|
+
def initialized?
|
249
|
+
!!get_main_hub
|
250
|
+
end
|
251
|
+
|
252
|
+
# Returns an uri for security policy reporting that's generated from the given DSN
|
253
|
+
# (To learn more about security policy reporting: https://docs.sentry.io/product/security-policy-reporting/)
|
254
|
+
#
|
255
|
+
# It returns nil if
|
256
|
+
# - The SDK is not initialized yet.
|
257
|
+
# - The DSN is not provided or is invalid.
|
258
|
+
#
|
259
|
+
# @return [String, nil]
|
260
|
+
def csp_report_uri
|
261
|
+
return unless initialized?
|
262
|
+
configuration.csp_report_uri
|
263
|
+
end
|
264
|
+
|
265
|
+
# Returns the main thread's active hub.
|
266
|
+
#
|
267
|
+
# @return [Hub]
|
268
|
+
def get_main_hub
|
269
|
+
@main_hub
|
270
|
+
end
|
271
|
+
|
272
|
+
# Takes an instance of Sentry::Breadcrumb and stores it to the current active scope.
|
273
|
+
#
|
274
|
+
# @return [Breadcrumb, nil]
|
275
|
+
def add_breadcrumb(breadcrumb, **options)
|
276
|
+
return unless initialized?
|
277
|
+
get_current_hub.add_breadcrumb(breadcrumb, **options)
|
278
|
+
end
|
279
|
+
|
280
|
+
# Returns the current active hub.
|
281
|
+
# If the current thread doesn't have an active hub, it will clone the main thread's active hub,
|
282
|
+
# stores it in the current thread, and then returns it.
|
283
|
+
#
|
284
|
+
# @return [Hub]
|
285
|
+
def get_current_hub
|
286
|
+
# we need to assign a hub to the current thread if it doesn't have one yet
|
287
|
+
#
|
288
|
+
# ideally, we should do this proactively whenever a new thread is created
|
289
|
+
# but it's impossible for the SDK to keep track every new thread
|
290
|
+
# so we need to use this rather passive way to make sure the app doesn't crash
|
291
|
+
Thread.current.thread_variable_get(THREAD_LOCAL) || clone_hub_to_current_thread
|
292
|
+
end
|
293
|
+
|
294
|
+
# Returns the current active client.
|
295
|
+
# @return [Client, nil]
|
296
|
+
def get_current_client
|
297
|
+
return unless initialized?
|
298
|
+
get_current_hub.current_client
|
299
|
+
end
|
300
|
+
|
301
|
+
# Returns the current active scope.
|
302
|
+
#
|
303
|
+
# @return [Scope, nil]
|
304
|
+
def get_current_scope
|
305
|
+
return unless initialized?
|
306
|
+
get_current_hub.current_scope
|
307
|
+
end
|
308
|
+
|
309
|
+
# Clones the main thread's active hub and stores it to the current thread.
|
310
|
+
#
|
311
|
+
# @return [void]
|
312
|
+
def clone_hub_to_current_thread
|
313
|
+
return unless initialized?
|
314
|
+
Thread.current.thread_variable_set(THREAD_LOCAL, get_main_hub.clone)
|
315
|
+
end
|
316
|
+
|
317
|
+
# Takes a block and yields the current active scope.
|
318
|
+
#
|
319
|
+
# @example
|
320
|
+
# Sentry.configure_scope do |scope|
|
321
|
+
# scope.set_tags(foo: "bar")
|
322
|
+
# end
|
323
|
+
#
|
324
|
+
# Sentry.capture_message("test message") # this event will have tags { foo: "bar" }
|
325
|
+
#
|
326
|
+
# @yieldparam scope [Scope]
|
327
|
+
# @return [void]
|
328
|
+
def configure_scope(&block)
|
329
|
+
return unless initialized?
|
330
|
+
get_current_hub.configure_scope(&block)
|
331
|
+
end
|
332
|
+
|
333
|
+
# Takes a block and yields a temporary scope.
|
334
|
+
# The temporary scope will inherit all the attributes from the current active scope and replace it to be the active
|
335
|
+
# scope inside the block.
|
336
|
+
#
|
337
|
+
# @example
|
338
|
+
# Sentry.configure_scope do |scope|
|
339
|
+
# scope.set_tags(foo: "bar")
|
340
|
+
# end
|
341
|
+
#
|
342
|
+
# Sentry.capture_message("test message") # this event will have tags { foo: "bar" }
|
343
|
+
#
|
344
|
+
# Sentry.with_scope do |temp_scope|
|
345
|
+
# temp_scope.set_tags(foo: "baz")
|
346
|
+
# Sentry.capture_message("test message 2") # this event will have tags { foo: "baz" }
|
347
|
+
# end
|
348
|
+
#
|
349
|
+
# Sentry.capture_message("test message 3") # this event will have tags { foo: "bar" }
|
350
|
+
#
|
351
|
+
# @yieldparam scope [Scope]
|
352
|
+
# @return [void]
|
353
|
+
def with_scope(&block)
|
354
|
+
return yield unless initialized?
|
355
|
+
get_current_hub.with_scope(&block)
|
356
|
+
end
|
357
|
+
|
358
|
+
# Wrap a given block with session tracking.
|
359
|
+
# Aggregate sessions in minutely buckets will be recorded
|
360
|
+
# around this block and flushed every minute.
|
361
|
+
#
|
362
|
+
# @example
|
363
|
+
# Sentry.with_session_tracking do
|
364
|
+
# a = 1 + 1 # new session recorded with :exited status
|
365
|
+
# end
|
366
|
+
#
|
367
|
+
# Sentry.with_session_tracking do
|
368
|
+
# 1 / 0
|
369
|
+
# rescue => e
|
370
|
+
# Sentry.capture_exception(e) # new session recorded with :errored status
|
371
|
+
# end
|
372
|
+
# @return [void]
|
373
|
+
def with_session_tracking(&block)
|
374
|
+
return yield unless initialized?
|
375
|
+
get_current_hub.with_session_tracking(&block)
|
376
|
+
end
|
377
|
+
|
378
|
+
# Takes an exception and reports it to Sentry via the currently active hub.
|
379
|
+
#
|
380
|
+
# @yieldparam scope [Scope]
|
381
|
+
# @return [Event, nil]
|
382
|
+
def capture_exception(exception, **options, &block)
|
383
|
+
return unless initialized?
|
384
|
+
get_current_hub.capture_exception(exception, **options, &block)
|
385
|
+
end
|
386
|
+
|
387
|
+
# Takes a block and evaluates it. If the block raised an exception, it reports the exception to Sentry and re-raises it.
|
388
|
+
# If the block ran without exception, it returns the evaluation result.
|
389
|
+
#
|
390
|
+
# @example
|
391
|
+
# Sentry.with_exception_captured do
|
392
|
+
# 1/1 #=> 1 will be returned
|
393
|
+
# end
|
394
|
+
#
|
395
|
+
# Sentry.with_exception_captured do
|
396
|
+
# 1/0 #=> ZeroDivisionError will be reported and re-raised
|
397
|
+
# end
|
398
|
+
#
|
399
|
+
def with_exception_captured(**options, &block)
|
400
|
+
yield
|
401
|
+
rescue Exception => e
|
402
|
+
capture_exception(e, **options)
|
403
|
+
raise
|
404
|
+
end
|
405
|
+
|
406
|
+
# Takes a message string and reports it to Sentry via the currently active hub.
|
407
|
+
#
|
408
|
+
# @yieldparam scope [Scope]
|
409
|
+
# @return [Event, nil]
|
410
|
+
def capture_message(message, **options, &block)
|
411
|
+
return unless initialized?
|
412
|
+
get_current_hub.capture_message(message, **options, &block)
|
413
|
+
end
|
414
|
+
|
415
|
+
# Takes an instance of Sentry::Event and dispatches it to the currently active hub.
|
416
|
+
#
|
417
|
+
# @return [Event, nil]
|
418
|
+
def capture_event(event)
|
419
|
+
return unless initialized?
|
420
|
+
get_current_hub.capture_event(event)
|
421
|
+
end
|
422
|
+
|
423
|
+
# Takes or initializes a new Sentry::Transaction and makes a sampling decision for it.
|
424
|
+
#
|
425
|
+
# @return [Transaction, nil]
|
426
|
+
def start_transaction(**options)
|
427
|
+
return unless initialized?
|
428
|
+
get_current_hub.start_transaction(**options)
|
429
|
+
end
|
430
|
+
|
431
|
+
# Records the block's execution as a child of the current span.
|
432
|
+
# If the current scope doesn't have a span, the block would still be executed but the yield param will be nil.
|
433
|
+
# @param attributes [Hash] attributes for the child span.
|
434
|
+
# @yieldparam child_span [Span, nil]
|
435
|
+
# @return yield result
|
436
|
+
#
|
437
|
+
# @example
|
438
|
+
# Sentry.with_child_span(op: "my operation") do |child_span|
|
439
|
+
# child_span.set_data(operation_data)
|
440
|
+
# child_span.set_description(operation_detail)
|
441
|
+
# # result will be returned
|
442
|
+
# end
|
443
|
+
#
|
444
|
+
def with_child_span(**attributes, &block)
|
445
|
+
return yield(nil) unless Sentry.initialized?
|
446
|
+
get_current_hub.with_child_span(**attributes, &block)
|
447
|
+
end
|
448
|
+
|
449
|
+
# Returns the id of the lastly reported Sentry::Event.
|
450
|
+
#
|
451
|
+
# @return [String, nil]
|
452
|
+
def last_event_id
|
453
|
+
return unless initialized?
|
454
|
+
get_current_hub.last_event_id
|
455
|
+
end
|
456
|
+
|
457
|
+
# Checks if the exception object has been captured by the SDK.
|
458
|
+
#
|
459
|
+
# @return [Boolean]
|
460
|
+
def exception_captured?(exc)
|
461
|
+
return false unless initialized?
|
462
|
+
!!exc.instance_variable_get(CAPTURED_SIGNATURE)
|
463
|
+
end
|
464
|
+
|
465
|
+
# Add a global event processor [Proc].
|
466
|
+
# These run before scope event processors.
|
467
|
+
#
|
468
|
+
# @yieldparam event [Event]
|
469
|
+
# @yieldparam hint [Hash, nil]
|
470
|
+
# @return [void]
|
471
|
+
#
|
472
|
+
# @example
|
473
|
+
# Sentry.add_global_event_processor do |event, hint|
|
474
|
+
# event.tags = { foo: 42 }
|
475
|
+
# event
|
476
|
+
# end
|
477
|
+
#
|
478
|
+
def add_global_event_processor(&block)
|
479
|
+
Scope.add_global_event_processor(&block)
|
480
|
+
end
|
481
|
+
|
482
|
+
##### Helpers #####
|
483
|
+
|
484
|
+
# @!visibility private
|
485
|
+
def sys_command(command)
|
486
|
+
result = `#{command} 2>&1` rescue nil
|
487
|
+
return if result.nil? || result.empty? || ($CHILD_STATUS && $CHILD_STATUS.exitstatus != 0)
|
488
|
+
|
489
|
+
result.strip
|
490
|
+
end
|
491
|
+
|
492
|
+
# @!visibility private
|
493
|
+
def logger
|
494
|
+
configuration.logger
|
495
|
+
end
|
496
|
+
|
497
|
+
# @!visibility private
|
498
|
+
def sdk_meta
|
499
|
+
META
|
500
|
+
end
|
501
|
+
|
502
|
+
# @!visibility private
|
503
|
+
def utc_now
|
504
|
+
Time.now.utc
|
505
|
+
end
|
506
|
+
end
|
507
|
+
end
|
508
|
+
|
509
|
+
# patches
|
510
|
+
require "sentry/net/http"
|
511
|
+
require "sentry/redis"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative "lib/sentry/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "sentry-ruby-core"
|
5
|
+
spec.version = Sentry::VERSION
|
6
|
+
spec.authors = ["Sentry Team"]
|
7
|
+
spec.description = spec.summary = "A gem that provides a client interface for the Sentry error logger"
|
8
|
+
spec.email = "accounts@sentry.io"
|
9
|
+
spec.license = 'MIT'
|
10
|
+
spec.homepage = "https://github.com/getsentry/sentry-ruby"
|
11
|
+
|
12
|
+
spec.platform = Gem::Platform::RUBY
|
13
|
+
spec.required_ruby_version = '>= 2.4'
|
14
|
+
spec.extra_rdoc_files = ["README.md", "LICENSE.txt"]
|
15
|
+
spec.files = `git ls-files | grep -Ev '^(spec|benchmarks|examples)'`.split("\n")
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
20
|
+
|
21
|
+
spec.add_dependency "sentry-ruby", Sentry::VERSION
|
22
|
+
spec.add_dependency "concurrent-ruby"
|
23
|
+
end
|
data/sentry-ruby.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require_relative "lib/sentry/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "sentry-ruby"
|
5
|
+
spec.version = Sentry::VERSION
|
6
|
+
spec.authors = ["Sentry Team"]
|
7
|
+
spec.description = spec.summary = "A gem that provides a client interface for the Sentry error logger"
|
8
|
+
spec.email = "accounts@sentry.io"
|
9
|
+
spec.license = 'MIT'
|
10
|
+
spec.homepage = "https://github.com/getsentry/sentry-ruby"
|
11
|
+
|
12
|
+
spec.platform = Gem::Platform::RUBY
|
13
|
+
spec.required_ruby_version = '>= 2.4'
|
14
|
+
spec.extra_rdoc_files = ["README.md", "LICENSE.txt"]
|
15
|
+
spec.files = `git ls-files | grep -Ev '^(spec|benchmarks|examples)'`.split("\n")
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
|
20
|
+
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_dependency "concurrent-ruby", '~> 1.0', '>= 1.0.2'
|
24
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentry-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.8.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:
|
11
|
+
date: 2023-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: sentry-ruby-core
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - '='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 5.3.0
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - '='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 5.3.0
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: concurrent-ruby
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,8 +38,72 @@ extra_rdoc_files:
|
|
52
38
|
- README.md
|
53
39
|
- LICENSE.txt
|
54
40
|
files:
|
41
|
+
- ".gitignore"
|
42
|
+
- ".rspec"
|
43
|
+
- ".yardopts"
|
44
|
+
- CHANGELOG.md
|
45
|
+
- CODE_OF_CONDUCT.md
|
46
|
+
- Gemfile
|
55
47
|
- LICENSE.txt
|
48
|
+
- Makefile
|
56
49
|
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- bin/console
|
52
|
+
- bin/setup
|
53
|
+
- lib/sentry-ruby.rb
|
54
|
+
- lib/sentry/background_worker.rb
|
55
|
+
- lib/sentry/backtrace.rb
|
56
|
+
- lib/sentry/baggage.rb
|
57
|
+
- lib/sentry/breadcrumb.rb
|
58
|
+
- lib/sentry/breadcrumb/sentry_logger.rb
|
59
|
+
- lib/sentry/breadcrumb_buffer.rb
|
60
|
+
- lib/sentry/client.rb
|
61
|
+
- lib/sentry/configuration.rb
|
62
|
+
- lib/sentry/core_ext/object/deep_dup.rb
|
63
|
+
- lib/sentry/core_ext/object/duplicable.rb
|
64
|
+
- lib/sentry/dsn.rb
|
65
|
+
- lib/sentry/envelope.rb
|
66
|
+
- lib/sentry/error_event.rb
|
67
|
+
- lib/sentry/event.rb
|
68
|
+
- lib/sentry/exceptions.rb
|
69
|
+
- lib/sentry/hub.rb
|
70
|
+
- lib/sentry/integrable.rb
|
71
|
+
- lib/sentry/interface.rb
|
72
|
+
- lib/sentry/interfaces/exception.rb
|
73
|
+
- lib/sentry/interfaces/request.rb
|
74
|
+
- lib/sentry/interfaces/single_exception.rb
|
75
|
+
- lib/sentry/interfaces/stacktrace.rb
|
76
|
+
- lib/sentry/interfaces/stacktrace_builder.rb
|
77
|
+
- lib/sentry/interfaces/threads.rb
|
78
|
+
- lib/sentry/linecache.rb
|
79
|
+
- lib/sentry/logger.rb
|
80
|
+
- lib/sentry/net/http.rb
|
81
|
+
- lib/sentry/rack.rb
|
82
|
+
- lib/sentry/rack/capture_exceptions.rb
|
83
|
+
- lib/sentry/rake.rb
|
84
|
+
- lib/sentry/redis.rb
|
85
|
+
- lib/sentry/release_detector.rb
|
86
|
+
- lib/sentry/scope.rb
|
87
|
+
- lib/sentry/session.rb
|
88
|
+
- lib/sentry/session_flusher.rb
|
89
|
+
- lib/sentry/span.rb
|
90
|
+
- lib/sentry/test_helper.rb
|
91
|
+
- lib/sentry/transaction.rb
|
92
|
+
- lib/sentry/transaction_event.rb
|
93
|
+
- lib/sentry/transport.rb
|
94
|
+
- lib/sentry/transport/configuration.rb
|
95
|
+
- lib/sentry/transport/dummy_transport.rb
|
96
|
+
- lib/sentry/transport/http_transport.rb
|
97
|
+
- lib/sentry/utils/argument_checking_helper.rb
|
98
|
+
- lib/sentry/utils/custom_inspection.rb
|
99
|
+
- lib/sentry/utils/encoding_helper.rb
|
100
|
+
- lib/sentry/utils/exception_cause_chain.rb
|
101
|
+
- lib/sentry/utils/logging_helper.rb
|
102
|
+
- lib/sentry/utils/real_ip.rb
|
103
|
+
- lib/sentry/utils/request_id.rb
|
104
|
+
- lib/sentry/version.rb
|
105
|
+
- sentry-ruby-core.gemspec
|
106
|
+
- sentry-ruby.gemspec
|
57
107
|
homepage: https://github.com/getsentry/sentry-ruby
|
58
108
|
licenses:
|
59
109
|
- MIT
|