sentry-ruby-core 4.6.4 → 4.6.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 442dc8b92f82ac1873cc066b8188d49ad4673425c2833416b5262c8076e4a13d
4
- data.tar.gz: 1c7b5d1d49ebc37da4cd3b524b50e0d50b1e7152cbbeb8f712603a57ceeac53c
3
+ metadata.gz: 4440f6ad3a4fd52dc9bd94c15a64e239a6957aca9adc7a410e8bd787d124bcae
4
+ data.tar.gz: c6736aba5112331695e81adc496f3c6ee5581ae2ee419ba880c912eb20cedde9
5
5
  SHA512:
6
- metadata.gz: e5f3aa0e7950fff974c056ac389218d68677804b590e1d94bac250070130630915d72905df42d88d6beb434912f893c3a86a6e0a734c8f6b7e6b91ae44d813e2
7
- data.tar.gz: d5f973ca005648a658c71e2c2e2a336bf68f7511b856147b4f8bcacd6234bf6d950e37d97af422dfc0c730f75e57e0e7a1ec41e2c819ed6cb222a811494d55e1
6
+ metadata.gz: e38a7ad731a84ee1886c341f8e6484c2019ad328b0a7c3bd93583d1f3056088f5f8e050bf0d0b764a5938c80ca7e704608aa2a107e6b9f915f76cb6dc701e1dc
7
+ data.tar.gz: fd137796bb363205ba78929c987b1cb1e3f7f494058e9fb8a31348ef29dd071994ec30a816b7de3befcdc018f91bc437cfade282fa65aa57952ac0e863580291
data/lib/sentry-ruby.rb CHANGED
@@ -36,15 +36,27 @@ module Sentry
36
36
 
37
37
  THREAD_LOCAL = :sentry_hub
38
38
 
39
- def self.sdk_meta
40
- META
41
- end
39
+ class << self
40
+ attr_accessor :background_worker
42
41
 
43
- def self.utc_now
44
- Time.now.utc
45
- end
42
+ ##### Patch Registration #####
43
+ #
44
+ def register_patch(&block)
45
+ registered_patches << block
46
+ end
46
47
 
47
- class << self
48
+ def apply_patches(config)
49
+ registered_patches.each do |patch|
50
+ patch.call(config)
51
+ end
52
+ end
53
+
54
+ def registered_patches
55
+ @registered_patches ||= []
56
+ end
57
+
58
+ ##### Integrations #####
59
+ #
48
60
  # Returns a hash that contains all the integrations that have been registered to the main SDK.
49
61
  def integrations
50
62
  @integrations ||= {}
@@ -55,32 +67,16 @@ module Sentry
55
67
  meta = { name: "sentry.ruby.#{name}", version: version }.freeze
56
68
  integrations[name.to_s] = meta
57
69
  end
58
- end
59
70
 
60
- class << self
71
+ ##### Method Delegation #####
72
+ #
61
73
  extend Forwardable
62
74
 
63
75
  def_delegators :get_current_client, :configuration, :send_event
64
76
  def_delegators :get_current_scope, :set_tags, :set_extras, :set_user, :set_context
65
77
 
66
- attr_accessor :background_worker
67
-
68
- @@registered_patches = []
69
-
70
- def register_patch(&block)
71
- registered_patches << block
72
- end
73
-
74
- def apply_patches(config)
75
- registered_patches.each do |patch|
76
- patch.call(config)
77
- end
78
- end
79
-
80
- def registered_patches
81
- @@registered_patches
82
- end
83
-
78
+ ##### Main APIs #####
79
+ #
84
80
  def init(&block)
85
81
  config = Configuration.new
86
82
  yield(config) if block_given?
@@ -100,8 +96,8 @@ module Sentry
100
96
  end
101
97
 
102
98
  # Takes an instance of Sentry::Breadcrumb and stores it to the current active scope.
103
- def add_breadcrumb(breadcrumb)
104
- get_current_hub&.add_breadcrumb(breadcrumb)
99
+ def add_breadcrumb(breadcrumb, **options)
100
+ get_current_hub&.add_breadcrumb(breadcrumb, **options)
105
101
  end
106
102
 
107
103
  # Returns the current active hub.
@@ -193,6 +189,9 @@ module Sentry
193
189
  get_current_hub&.last_event_id
194
190
  end
195
191
 
192
+
193
+ ##### Helpers #####
194
+ #
196
195
  def sys_command(command)
197
196
  result = `#{command} 2>&1` rescue nil
198
197
  return if result.nil? || result.empty? || ($CHILD_STATUS && $CHILD_STATUS.exitstatus != 0)
@@ -207,6 +206,14 @@ module Sentry
207
206
  def logger
208
207
  configuration.logger
209
208
  end
209
+
210
+ def sdk_meta
211
+ META
212
+ end
213
+
214
+ def utc_now
215
+ Time.now.utc
216
+ end
210
217
  end
211
218
  end
212
219
 
@@ -67,7 +67,7 @@ module Sentry
67
67
  type: severity >= 3 ? "error" : level
68
68
  )
69
69
 
70
- Sentry.add_breadcrumb(crumb)
70
+ Sentry.add_breadcrumb(crumb, hint: { severity: severity })
71
71
  end
72
72
  end
73
73
 
data/lib/sentry/client.rb CHANGED
@@ -26,7 +26,12 @@ module Sentry
26
26
  def capture_event(event, scope, hint = {})
27
27
  return unless configuration.sending_allowed?
28
28
 
29
- scope.apply_to_event(event, hint)
29
+ event = scope.apply_to_event(event, hint)
30
+
31
+ if event.nil?
32
+ log_info("Discarded event because one of the event processors returned nil")
33
+ return
34
+ end
30
35
 
31
36
  if async_block = configuration.async
32
37
  dispatch_async_event(async_block, event, hint)
@@ -1,3 +1,3 @@
1
1
  module Sentry
2
- VERSION = "4.6.4"
2
+ VERSION = "4.6.5"
3
3
  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.6.4
4
+ version: 4.6.5
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-07-29 00:00:00.000000000 Z
11
+ date: 2021-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday