sentry-ruby-core 4.6.0.pre.beta.0 → 4.6.3

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: 3fd251a3cc580751fb454b148652d6cc3236a909ff08b401a4127ca29c8cb596
4
- data.tar.gz: '094f5c198cfff5179a7139668a69679e934498dbcfb45ebb418f94e0255a3cc1'
3
+ metadata.gz: d11c35de1743f0035364e78a4866425e8976f632363ccc83f63a9f6954e43b29
4
+ data.tar.gz: 79fe8dad952d06b588407109bc10a8f191ec04739edd5115efd3dbe7a32253d8
5
5
  SHA512:
6
- metadata.gz: 97e91ace33cd6158779c4478e9f5d678045dc3c67bcb776040c4e7bd009f8cd7f52bf0c58d2a22e430e339931c7bb9c32a667731abae859427ef0827825bebfa
7
- data.tar.gz: 183c877035a4c8e2dfdda837dd048d65a16862aa29cb0c2490cdd974609d28722eefdd7eb2d0f62d07ffde8fab842fbc5c265f89e0d8f843b3c9e1eefef2f0af
6
+ metadata.gz: 38d2f4b123c3df2f28117997a769cf54ea1fa4af2eb1e14cc1492b54a23ad0ed53abd8f0ae2492e30abd50df1bccd79d6e8987227ec0dae5411e7130c13821f0
7
+ data.tar.gz: c1c558a090aa8852b11af61e082ecf2977e948b7cce74c1331e1f019129376492169c901bb6a1b0b89802517b0b89559899e6f414ea93b80d40fee34565a2506
data/README.md CHANGED
@@ -12,10 +12,11 @@ Sentry SDK for Ruby
12
12
 
13
13
  | current version | build | coverage | downloads | semver stability |
14
14
  | --- | ----- | -------- | --------- | ---------------- |
15
- | [![Gem Version](https://img.shields.io/gem/v/sentry-ruby?label=sentry-ruby)](https://github.com/getsentry/sentry-ruby/blob/master/sentry-ruby/CHANGELOG.md) | ![Build Status](https://github.com/getsentry/sentry-ruby/workflows/sentry-ruby%20Test/badge.svg) | [![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/sentry-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [![Downloads](https://img.shields.io/gem/dt/sentry-ruby.svg)](https://rubygems.org/gems/sentry-ruby/) | [![SemVer stability](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-ruby&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-ruby&package-manager=bundler&version-scheme=semver) |
16
- | [![Gem Version](https://img.shields.io/gem/v/sentry-rails?label=sentry-rails)](https://github.com/getsentry/sentry-ruby/blob/master/sentry-rails/CHANGELOG.md) | ![Build Status](https://github.com/getsentry/sentry-ruby/workflows/sentry-rails%20Test/badge.svg) | [![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/sentry-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [![Downloads](https://img.shields.io/gem/dt/sentry-rails.svg)](https://rubygems.org/gems/sentry-rails/) | [![SemVer stability](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-rails&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-rails&package-manager=bundler&version-scheme=semver) |
17
- | [![Gem Version](https://img.shields.io/gem/v/sentry-sidekiq?label=sentry-sidekiq)](https://github.com/getsentry/sentry-ruby/blob/master/sentry-sidekiq/CHANGELOG.md) | ![Build Status](https://github.com/getsentry/sentry-ruby/workflows/sentry-sidekiq%20Test/badge.svg) | [![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/sentry-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [![Downloads](https://img.shields.io/gem/dt/sentry-sidekiq.svg)](https://rubygems.org/gems/sentry-sidekiq/) | [![SemVer stability](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-sidekiq&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-sidekiq&package-manager=bundler&version-scheme=semver) |
18
- | [![Gem Version](https://img.shields.io/gem/v/sentry-delayed_job?label=sentry-delayed_job)](https://github.com/getsentry/sentry-ruby/blob/master/sentry-delayed_job/CHANGELOG.md) | ![Build Status](https://github.com/getsentry/sentry-ruby/workflows/sentry-delayed_job%20Test/badge.svg) | [![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/sentry-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [![Downloads](https://img.shields.io/gem/dt/sentry-delayed_job.svg)](https://rubygems.org/gems/sentry-delayed_job/) | [![SemVer stability](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-delayed_job&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-delayed_job&package-manager=bundler&version-scheme=semver) |
15
+ | [![Gem Version](https://img.shields.io/gem/v/sentry-ruby?label=sentry-ruby)](https://rubygems.org/gems/sentry-ruby) | [![Build Status](https://github.com/getsentry/sentry-ruby/workflows/sentry-ruby%20Test/badge.svg)](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_ruby_test.yml) | [![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/sentry-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [![Downloads](https://img.shields.io/gem/dt/sentry-ruby.svg)](https://rubygems.org/gems/sentry-ruby/) | [![SemVer stability](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-ruby&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-ruby&package-manager=bundler&version-scheme=semver) |
16
+ | [![Gem Version](https://img.shields.io/gem/v/sentry-rails?label=sentry-rails)](https://rubygems.org/gems/sentry-rails) | [![Build Status](https://github.com/getsentry/sentry-ruby/workflows/sentry-rails%20Test/badge.svg)](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_rails_test.yml) | [![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/sentry-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [![Downloads](https://img.shields.io/gem/dt/sentry-rails.svg)](https://rubygems.org/gems/sentry-rails/) | [![SemVer stability](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-rails&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-rails&package-manager=bundler&version-scheme=semver) |
17
+ | [![Gem Version](https://img.shields.io/gem/v/sentry-sidekiq?label=sentry-sidekiq)](https://rubygems.org/gems/sentry-sidekiq) | [![Build Status](https://github.com/getsentry/sentry-ruby/workflows/sentry-sidekiq%20Test/badge.svg)](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_sidekiq_test.yml) | [![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/sentry-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [![Downloads](https://img.shields.io/gem/dt/sentry-sidekiq.svg)](https://rubygems.org/gems/sentry-sidekiq/) | [![SemVer stability](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-sidekiq&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-sidekiq&package-manager=bundler&version-scheme=semver) |
18
+ | [![Gem Version](https://img.shields.io/gem/v/sentry-delayed_job?label=sentry-delayed_job)](https://rubygems.org/gems/sentry-delayed_job) | [![Build Status](https://github.com/getsentry/sentry-ruby/workflows/sentry-delayed_job%20Test/badge.svg)](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_delayed_job_test.yml) | [![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/sentry-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [![Downloads](https://img.shields.io/gem/dt/sentry-delayed_job.svg)](https://rubygems.org/gems/sentry-delayed_job/) | [![SemVer stability](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-delayed_job&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-delayed_job&package-manager=bundler&version-scheme=semver) |
19
+ | [![Gem Version](https://img.shields.io/gem/v/sentry-resque?label=sentry-resque)](https://rubygems.org/gems/sentry-resque) | [![Build Status](https://github.com/getsentry/sentry-ruby/workflows/sentry-resque%20Test/badge.svg)](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_resque_test.yml) | [![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/sentry-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/sentry-ruby/branch/master) | [![Downloads](https://img.shields.io/gem/dt/sentry-resque.svg)](https://rubygems.org/gems/sentry-resque/) | [![SemVer stability](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-resque&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-resque&package-manager=bundler&version-scheme=semver) |
19
20
 
20
21
 
21
22
 
@@ -46,200 +47,51 @@ and depends on the integrations you want to have, you might also want to install
46
47
  gem "sentry-rails"
47
48
  gem "sentry-sidekiq"
48
49
  gem "sentry-delayed_job"
49
- # and mores to come in the future!
50
+ gem "sentry-resque"
50
51
  ```
51
52
 
52
- ### Sentry only runs when Sentry DSN is set
53
+ ### Configuration
53
54
 
54
- Sentry will capture and send exceptions to the Sentry server whenever its DSN is set. This makes environment-based configuration easy - if you don't want to send errors in a certain environment, just don't set the DSN in that environment!
55
+ You can use `Sentry.init` to initialize and configure your SDK:
55
56
 
56
- ```bash
57
- # Set your SENTRY_DSN environment variable.
58
- export SENTRY_DSN=http://public@example.com/project-id
59
- ```
60
57
  ```ruby
61
- # Or you can configure the client in the code.
62
58
  Sentry.init do |config|
63
- config.dsn = 'http://public@example.com/project-id'
59
+ config.dsn = "MY_DSN"
64
60
  end
65
- ```
66
-
67
- ### Sentry doesn't report some kinds of data by default
68
61
 
69
- **Sentry ignores some exceptions by default** - most of these are related to 404s parameter parsing errors. [For a complete list, see the `IGNORE_DEFAULT` constant](https://github.com/getsentry/sentry-ruby/blob/master/sentry-ruby/lib/sentry/configuration.rb#L151) and the integration gems' `IGNORE_DEFAULT`, like [`sentry-rails`'s](https://github.com/getsentry/sentry-ruby/blob/master/sentry-rails/lib/sentry/rails/configuration.rb#L12)
70
-
71
- Sentry doesn't send personally identifiable information (pii) by default, such as request body, user ip or cookies. If you want those information to be sent, you can use the `send_default_pii` config option:
72
-
73
- ```ruby
74
- Sentry.init do |config|
75
- # other configs
76
- config.send_default_pii = true
77
- end
78
62
  ```
79
63
 
64
+ To learn more about available configuration options, please visit the [official documentation](https://docs.sentry.io/platforms/ruby/configuration/options/).
65
+
80
66
  ### Performance Monitoring
81
67
 
82
- You can activate performance monitoring by enabling traces sampling:
68
+ You can activate [performance monitoring](https://docs.sentry.io/platforms/ruby/performance) by enabling traces sampling:
83
69
 
84
70
  ```ruby
85
71
  Sentry.init do |config|
86
72
  # set a uniform sample rate between 0.0 and 1.0
87
73
  config.traces_sample_rate = 0.2
88
-
89
- # or control sampling dynamically
90
- config.traces_sampler = lambda do |sampling_context|
91
- # sampling_context[:transaction_context] contains the information about the transaction
92
- # sampling_context[:parent_sampled] contains the transaction's parent's sample decision
93
- true # return value can be a boolean or a float between 0.0 and 1.0
94
- end
74
+ # you can also use traces_sampler for more fine-grained sampling
75
+ # please click the link below to learn more
95
76
  end
96
77
  ```
97
78
 
98
- To learn more about performance monitoring, please visit the [official documentation](https://docs.sentry.io/platforms/ruby/performance).
79
+ To learn more about sampling transactions, please visit the [official documentation](https://docs.sentry.io/platforms/ruby/configuration/sampling/#configuring-the-transaction-sample-rate).
99
80
 
100
- ### Usage
81
+ ### Integrations
101
82
 
102
- `sentry-ruby` has a default integration with `Rack`, so you only need to use the middleware in your application like:
83
+ - [Rack](https://docs.sentry.io/platforms/ruby/guides/rack/)
84
+ - [Rails](https://docs.sentry.io/platforms/ruby/guides/rails/)
85
+ - [Sidekiq](https://docs.sentry.io/platforms/ruby/guides/sidekiq/)
86
+ - [DelayedJob](https://docs.sentry.io/platforms/ruby/guides/delayed_job/)
87
+ - [Resque](https://docs.sentry.io/platforms/ruby/guides/resque/)
103
88
 
104
- ```ruby
105
- require 'sentry-ruby'
106
-
107
- Sentry.init do |config|
108
- config.dsn = 'https://examplePublicKey@o0.ingest.sentry.io/0'
109
-
110
- # To activate performance monitoring, set one of these options.
111
- # We recommend adjusting the value in production:
112
- config.traces_sample_rate = 0.5
113
- # or
114
- config.traces_sampler = lambda do |context|
115
- true
116
- end
117
- end
118
-
119
- use Sentry::Rack::CaptureExceptions
120
- ```
121
-
122
- Otherwise, Sentry you can always use the capture helpers manually
123
-
124
- ```ruby
125
- Sentry.capture_message("hello world!")
126
-
127
- begin
128
- 1 / 0
129
- rescue ZeroDivisionError => exception
130
- Sentry.capture_exception(exception)
131
- end
132
- ```
133
-
134
- We also provide integrations with popular frameworks/libraries with the related extensions:
135
-
136
- - [sentry-rails](https://github.com/getsentry/sentry-ruby/tree/master/sentry-rails)
137
- - [sentry-sidekiq](https://github.com/getsentry/sentry-ruby/tree/master/sentry-sidekiq)
138
- - [sentry-delayed_job](https://github.com/getsentry/sentry-ruby/tree/master/sentry-delayed_job)
139
-
140
- ### More configuration
141
-
142
- You're all set - but there's a few more settings you may want to know about too!
143
-
144
- #### Blocking v.s. Non-blocking
145
-
146
- `sentry-ruby` sends events asynchronously by default. The functionality works like this:
147
-
148
- 1. When the SDK is initialized, a `Sentry::BackgroundWorker` will be initialized too.
149
- 2. When an event is passed to `Client#capture_event`, instead of sending it directly with `Client#send_event`, we'll let the worker do it.
150
- 3. The worker will have a number of threads. And the one of the idle threads will pick the job and call `Client#send_event`.
151
- - If all the threads are busy, new jobs will be put into a queue, which has a limit of 30.
152
- - If the queue size is exceeded, new events will be dropped.
153
-
154
- However, if you still prefer to use your own async approach, that's totally fine. If you have `config.async` set, the worker won't initialize a thread pool and won't be used either.
155
-
156
- ##### About `Sentry::BackgroundWorker`
157
-
158
- - The worker is built on top of the [concurrent-ruby](https://github.com/ruby-concurrency/concurrent-ruby) gem's [ThreadPoolExecutor](http://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/ThreadPoolExecutor.html), which is also used by Rails ActiveJob's async adapter. This should minimize the risk of messing up client applications with our own thread pool implementaion.
159
-
160
- This functionality also introduces a new `background_worker_threads` config option. It allows you to decide how many threads should the worker hold. By default, the value will be the number of the processors your machine has. For example, if your machine has 4 processors, the value would be 4.
161
-
162
- Of course, you can always override the value to fit your use cases, like
163
-
164
- ```ruby
165
- config.background_worker_threads = 5 # the worker will have 5 threads for sending events
166
- ```
167
-
168
- You can also disable this new non-blocking behaviour by giving a `0` value:
169
-
170
- ```ruby
171
- config.background_worker_threads = 0 # all events will be sent synchronously
172
- ```
89
+ ### Enriching Events
173
90
 
174
- If you want to send a particular event immediately, you can use event hints to do it:
175
-
176
- ```ruby
177
- Sentry.capture_message("send me now!", hint: { background: false })
178
- ```
179
-
180
- ##### `config.async`
181
-
182
- You can also use `config.async` to send events with you own worker:
183
-
184
- ```ruby
185
- config.async = lambda { |event, hint| SentryJob.perform_later(event, hint) }
186
- ```
187
-
188
- And if you use `sentry-rails`, you can directly use the job we defined for you:
189
-
190
- ```ruby
191
- config.async = lambda { |event, hint| Sentry::SendEventJob.perform_later(event, hint) }
192
- ```
193
-
194
-
195
- #### Contexts
196
-
197
- In sentry-ruby, every event will inherit their contextual data from the current scope. So you can enrich the event's data by configuring the current scope like:
198
-
199
- ```ruby
200
- Sentry.configure_scope do |scope|
201
- scope.set_user(id: 1, email: "test@example.com")
202
-
203
- scope.set_tag(:tag, "foo")
204
- scope.set_tags(tag_1: "foo", tag_2: "bar")
205
-
206
- scope.set_extra(:order_number, 1234)
207
- scope.set_extras(order_number: 1234, tickets_count: 4)
208
- end
209
-
210
- Sentry.capture_exception(exception) # the event will carry all those information now
211
- ```
212
-
213
- Or use top-level setters
214
-
215
-
216
- ```ruby
217
- Sentry.set_user(id: 1, email: "test@example.com")
218
- Sentry.set_tags(tag_1: "foo", tag_2: "bar")
219
- Sentry.set_extras(order_number: 1234, tickets_count: 4)
220
- ```
221
-
222
- Or build up a temporary scope for local information:
223
-
224
- ```ruby
225
- Sentry.configure_scope do |scope|
226
- scope.set_tags(tag_1: "foo")
227
- end
228
-
229
- Sentry.with_scope do |scope|
230
- scope.set_tags(tag_1: "bar", tag_2: "baz")
231
-
232
- Sentry.capture_message("message") # this event will have 2 tags: tag_1 => "bar" and tag_2 => "baz"
233
- end
234
-
235
- Sentry.capture_message("another message") # this event will have 1 tag: tag_1 => "foo"
236
- ```
237
-
238
- Of course, you can always assign the information on a per-event basis:
239
-
240
- ```ruby
241
- Sentry.capture_exception(exception, tags: {foo: "bar"})
242
- ```
91
+ - [Add more data to the current scope](https://docs.sentry.io/platforms/ruby/guides/rack/enriching-events/scopes/)
92
+ - [Add custom breadcrumbs](https://docs.sentry.io/platforms/ruby/guides/rack/enriching-events/breadcrumbs/)
93
+ - [Add contextual data](https://docs.sentry.io/platforms/ruby/guides/rack/enriching-events/context/)
94
+ - [Add tags](https://docs.sentry.io/platforms/ruby/guides/rack/enriching-events/tags/)
243
95
 
244
96
  ## Resources
245
97
 
@@ -405,7 +405,7 @@ module Sentry
405
405
  def sample_allowed?
406
406
  return true if sample_rate == 1.0
407
407
 
408
- if Random::DEFAULT.rand >= sample_rate
408
+ if Random.rand >= sample_rate
409
409
  @errors << "Excluded by random sample"
410
410
  false
411
411
  else
@@ -1,3 +1,5 @@
1
+ return if Object.method_defined?(:deep_dup)
2
+
1
3
  require 'sentry/core_ext/object/duplicable'
2
4
 
3
5
  #########################################
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+ return if Object.method_defined?(:duplicable?)
2
3
 
3
4
  #########################################
4
5
  # This file was copied from Rails 5.2 #
data/lib/sentry/dsn.rb CHANGED
@@ -37,7 +37,6 @@ module Sentry
37
37
  def server
38
38
  server = "#{scheme}://#{host}"
39
39
  server += ":#{port}" unless port == PORT_MAP[scheme]
40
- server += path
41
40
  server
42
41
  end
43
42
 
data/lib/sentry/event.rb CHANGED
@@ -9,7 +9,7 @@ require 'sentry/utils/request_id'
9
9
 
10
10
  module Sentry
11
11
  class Event
12
- ATTRIBUTES = %i(
12
+ SERIALIZEABLE_ATTRIBUTES = %i(
13
13
  event_id level timestamp
14
14
  release environment server_name modules
15
15
  message user tags contexts extra
@@ -17,9 +17,13 @@ module Sentry
17
17
  platform sdk type
18
18
  )
19
19
 
20
+ WRITER_ATTRIBUTES = SERIALIZEABLE_ATTRIBUTES - %i(type timestamp level)
21
+
20
22
  MAX_MESSAGE_SIZE_IN_BYTES = 1024 * 8
21
23
 
22
- attr_accessor(*ATTRIBUTES)
24
+ attr_writer(*WRITER_ATTRIBUTES)
25
+ attr_reader(*SERIALIZEABLE_ATTRIBUTES)
26
+
23
27
  attr_reader :configuration, :request, :exception, :threads
24
28
 
25
29
  def initialize(configuration:, integration_meta: nil, message: nil)
@@ -99,9 +103,6 @@ module Sentry
99
103
  end
100
104
  end
101
105
 
102
- def type
103
- end
104
-
105
106
  def to_hash
106
107
  data = serialize_attributes
107
108
  data[:breadcrumbs] = breadcrumbs.to_hash if breadcrumbs
@@ -139,7 +140,7 @@ module Sentry
139
140
  private
140
141
 
141
142
  def serialize_attributes
142
- self.class::ATTRIBUTES.each_with_object({}) do |att, memo|
143
+ self.class::SERIALIZEABLE_ATTRIBUTES.each_with_object({}) do |att, memo|
143
144
  if value = public_send(att)
144
145
  memo[att] = value
145
146
  end
data/lib/sentry/hub.rb CHANGED
@@ -144,6 +144,17 @@ module Sentry
144
144
  current_scope.add_breadcrumb(breadcrumb)
145
145
  end
146
146
 
147
+ # this doesn't do anything to the already initialized background worker
148
+ # but it temporarily disables dispatching events to it
149
+ def with_background_worker_disabled(&block)
150
+ original_background_worker_threads = configuration.background_worker_threads
151
+ configuration.background_worker_threads = 0
152
+
153
+ block.call
154
+ ensure
155
+ configuration.background_worker_threads = original_background_worker_threads
156
+ end
157
+
147
158
  private
148
159
 
149
160
  def current_layer
data/lib/sentry/rake.rb CHANGED
@@ -3,6 +3,7 @@ require "rake/task"
3
3
 
4
4
  module Rake
5
5
  class Application
6
+
6
7
  alias orig_display_error_messsage display_error_message
7
8
  def display_error_message(ex)
8
9
  Sentry.capture_exception(ex, hint: { background: false }) do |scope|
@@ -14,4 +15,16 @@ module Rake
14
15
  orig_display_error_messsage(ex)
15
16
  end
16
17
  end
18
+
19
+ class Task
20
+ alias orig_execute execute
21
+
22
+ def execute(args=nil)
23
+ return orig_execute(args) unless Sentry.initialized? && Sentry.get_current_hub
24
+
25
+ Sentry.get_current_hub.with_background_worker_disabled do
26
+ orig_execute(args)
27
+ end
28
+ end
29
+ end
17
30
  end
@@ -4,22 +4,27 @@ module Sentry
4
4
  class TransactionEvent < Event
5
5
  TYPE = "transaction"
6
6
 
7
- ATTRIBUTES = %i(
7
+ SERIALIZEABLE_ATTRIBUTES = %i(
8
8
  event_id level timestamp start_timestamp
9
9
  release environment server_name modules
10
10
  user tags contexts extra
11
11
  transaction platform sdk type
12
12
  )
13
13
 
14
- attr_accessor(*ATTRIBUTES)
14
+ WRITER_ATTRIBUTES = SERIALIZEABLE_ATTRIBUTES - %i(type timestamp start_timestamp level)
15
+
16
+ attr_writer(*WRITER_ATTRIBUTES)
17
+ attr_reader(*SERIALIZEABLE_ATTRIBUTES)
18
+
15
19
  attr_accessor :spans
16
20
 
17
- def start_timestamp=(time)
18
- @start_timestamp = time.is_a?(Time) ? time.to_f : time
21
+ def initialize(configuration:, integration_meta: nil, message: nil)
22
+ super
23
+ @type = TYPE
19
24
  end
20
25
 
21
- def type
22
- TYPE
26
+ def start_timestamp=(time)
27
+ @start_timestamp = time.is_a?(Time) ? time.to_f : time
23
28
  end
24
29
 
25
30
  def to_hash
@@ -2,7 +2,8 @@ module Sentry
2
2
  class Transport
3
3
  class Configuration
4
4
  attr_accessor :timeout, :open_timeout, :proxy, :ssl, :ssl_ca_file, :ssl_verification, :http_adapter, :faraday_builder,
5
- :transport_class, :encoding
5
+ :encoding
6
+ attr_reader :transport_class
6
7
 
7
8
  def initialize
8
9
  @ssl_verification = true
@@ -29,7 +29,13 @@ module Sentry
29
29
  @client_ip = client_ip
30
30
  @real_ip = real_ip
31
31
  @forwarded_for = forwarded_for
32
- @trusted_proxies = (LOCAL_ADDRESSES + Array(trusted_proxies)).map { |proxy| IPAddr.new(proxy.to_s) }.uniq
32
+ @trusted_proxies = (LOCAL_ADDRESSES + Array(trusted_proxies)).map do |proxy|
33
+ if proxy.is_a?(IPAddr)
34
+ proxy
35
+ else
36
+ IPAddr.new(proxy.to_s)
37
+ end
38
+ end.uniq
33
39
  end
34
40
 
35
41
  def calculate_ip
@@ -1,3 +1,3 @@
1
1
  module Sentry
2
- VERSION = "4.6.0-beta.0"
2
+ VERSION = "4.6.3"
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.0.pre.beta.0
4
+ version: 4.6.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: 2021-06-28 00:00:00.000000000 Z
11
+ date: 2021-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -119,9 +119,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
119
  version: '2.4'
120
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: 1.3.1
124
+ version: '0'
125
125
  requirements: []
126
126
  rubygems_version: 3.1.6
127
127
  signing_key: