sentry-ruby-core 4.5.0.pre.beta.1 → 4.6.0

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: 39b0d720876099298375f0ea0130ced0effa7fe7cb3c153d5075cff400788d7a
4
- data.tar.gz: 3e89ef0214a1b632274605984514aa4703d6aea3bcc6c625d8f32eaa2f552203
3
+ metadata.gz: cfe5056c156c748700100bc8c0a08188547f04ef0c09d7ee7653c084407e294e
4
+ data.tar.gz: 63562591edc3eb48be9e0cf22ab17a3787a5ee91784978252dd67dd050128abe
5
5
  SHA512:
6
- metadata.gz: 263a733c7d5c2ca356a1de8f5b75b7ec1266e1ea6abe57b20db0a4789a2bd7bb1444dababc06a1291089c009dbcae05b8ded8a11bcd21f721ece3df454e1fb8b
7
- data.tar.gz: b256b35de1a11df8e0b3468d47365fec0646da828f05e3161cd4b0374a5b7fda4586d911146895d04bb6574306688b587012c6b85d3b09baf096771efb3d1e49
6
+ metadata.gz: 777e2a93032b22c039dec36aa8eb859de7169a0cb438d3204bb7620a0e290ff8a4b747c196ff093008d2fe61f066cf6368d8bddda2fba9e7127ec4985ca1968a
7
+ data.tar.gz: 35bb4ff5ab8d01fbd1d2882b2e3f0382a24248bca2e3b3a2be80a2e80c8fea6d5e10316b9c8962407e43f72a84cae3f201c8dadf4f80526cd584d9c238aa47a1
data/CHANGELOG.md CHANGED
@@ -1,24 +1,6 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
4
-
5
- ### Features
6
-
7
- - Implement sentry-trace propagation [#1446](https://github.com/getsentry/sentry-ruby/pull/1446)
8
-
9
- The SDK will insert the `sentry-trace` to outgoing requests made with `Net::HTTP`. Its value would look like `d827317d25d5420aa3aa97a0257db998-57757614642bdff5-1`.
10
-
11
- If the receiver service also uses Sentry and the SDK supports performance monitoring, its tracing event will be connected with the sender application's.
12
-
13
- Example:
14
-
15
- <img width="1283" alt="connect sentry trace" src="https://user-images.githubusercontent.com/5079556/118963250-d7b40980-b998-11eb-9de4-598d1b220137.png">
16
-
17
- This feature is activated by default. But users can use the new `config.propagate_traces` config option to disable it.
18
-
19
- ### Bug Fixes
20
-
21
- - Allow toggling background sending on the fly [#1447](https://github.com/getsentry/sentry-ruby/pull/1447)
3
+ Individual gem's changelog has been deprecated. Please check the [project changelog](https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md).
22
4
 
23
5
  ## 4.4.2
24
6
 
data/Gemfile CHANGED
@@ -3,8 +3,7 @@ source "https://rubygems.org"
3
3
  gem "sentry-ruby-core", path: "./"
4
4
  gem "sentry-ruby", path: "./"
5
5
 
6
- # TODO: Remove this if https://github.com/jruby/jruby/issues/6547 is addressed
7
- gem "i18n", "<= 1.8.7"
6
+ gem "rack" unless ENV["WITHOUT_RACK"] == "1"
8
7
 
9
8
  gem "rake", "~> 12.0"
10
9
  gem "rspec", "~> 3.0"
@@ -12,10 +11,10 @@ gem "rspec-retry"
12
11
  gem "webmock"
13
12
  gem "timecop"
14
13
  gem "codecov", "0.2.12"
15
- gem "tapping_device"
16
14
 
15
+ gem "object_tracer"
16
+ gem "debug", github: "ruby/debug" if RUBY_VERSION.to_f >= 2.6
17
17
  gem "pry"
18
- gem "rack" unless ENV["WITHOUT_RACK"] == "1"
19
18
 
20
19
  gem "benchmark-ips"
21
20
  gem "benchmark_driver"
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
 
data/lib/sentry-ruby.rb CHANGED
@@ -84,6 +84,7 @@ module Sentry
84
84
  def init(&block)
85
85
  config = Configuration.new
86
86
  yield(config) if block_given?
87
+ config.detect_release
87
88
  apply_patches(config)
88
89
  client = Client.new(config)
89
90
  scope = Scope.new(max_breadcrumbs: config.max_breadcrumbs)
@@ -2,15 +2,16 @@ module Sentry
2
2
  class Breadcrumb
3
3
  DATA_SERIALIZATION_ERROR_MESSAGE = "[data were removed due to serialization issues]"
4
4
 
5
- attr_accessor :category, :data, :message, :level, :timestamp, :type
5
+ attr_accessor :category, :data, :level, :timestamp, :type
6
+ attr_reader :message
6
7
 
7
8
  def initialize(category: nil, data: nil, message: nil, timestamp: nil, level: nil, type: nil)
8
9
  @category = category
9
10
  @data = data || {}
10
11
  @level = level
11
- @message = message
12
12
  @timestamp = timestamp || Sentry.utc_now.to_i
13
13
  @type = type
14
+ self.message = message
14
15
  end
15
16
 
16
17
  def to_hash
@@ -24,6 +25,10 @@ module Sentry
24
25
  }
25
26
  end
26
27
 
28
+ def message=(msg)
29
+ @message = (msg || "").byteslice(0..Event::MAX_MESSAGE_SIZE_IN_BYTES)
30
+ end
31
+
27
32
  private
28
33
 
29
34
  def serialized_data
@@ -130,6 +130,9 @@ module Sentry
130
130
  # will not be sent to Sentry.
131
131
  attr_accessor :send_default_pii
132
132
 
133
+ # Allow to skip Sentry emails within rake tasks
134
+ attr_accessor :skip_rake_integration
135
+
133
136
  # IP ranges for trusted proxies that will be skipped when calculating IP address.
134
137
  attr_accessor :trusted_proxies
135
138
 
@@ -195,10 +198,10 @@ module Sentry
195
198
  self.project_root = Dir.pwd
196
199
  self.propagate_traces = true
197
200
 
198
- self.release = detect_release
199
201
  self.sample_rate = 1.0
200
202
  self.send_modules = true
201
203
  self.send_default_pii = false
204
+ self.skip_rake_integration = false
202
205
  self.trusted_proxies = []
203
206
  self.dsn = ENV['SENTRY_DSN']
204
207
  self.server_name = server_name_from_env
@@ -310,10 +313,10 @@ module Sentry
310
313
  )
311
314
  end
312
315
 
313
- private
314
-
315
316
  def detect_release
316
- detect_release_from_env ||
317
+ return unless sending_allowed?
318
+
319
+ self.release ||= detect_release_from_env ||
317
320
  detect_release_from_git ||
318
321
  detect_release_from_capistrano ||
319
322
  detect_release_from_heroku
@@ -321,6 +324,8 @@ module Sentry
321
324
  log_error("Error detecting release", e, debug: debug)
322
325
  end
323
326
 
327
+ private
328
+
324
329
  def excluded_exception?(incoming_exception)
325
330
  excluded_exception_classes.any? do |excluded_exception|
326
331
  matches_exception?(excluded_exception, incoming_exception)
@@ -57,6 +57,7 @@ module Sentry
57
57
  request.POST
58
58
  elsif request.body # JSON requests, etc
59
59
  data = request.body.read(MAX_BODY_LIMIT)
60
+ data = data.force_encoding(Encoding::UTF_8) if data.respond_to?(:force_encoding)
60
61
  request.body.rewind
61
62
  data
62
63
  end
data/lib/sentry/rack.rb CHANGED
@@ -1,4 +1,3 @@
1
1
  require 'rack'
2
2
 
3
3
  require 'sentry/rack/capture_exceptions'
4
- require 'sentry/rack/deprecations'
data/lib/sentry/rake.rb CHANGED
@@ -9,7 +9,7 @@ module Rake
9
9
  task_name = top_level_tasks.join(' ')
10
10
  scope.set_transaction_name(task_name)
11
11
  scope.set_tag("rake_task", task_name)
12
- end if Sentry.initialized?
12
+ end if Sentry.initialized? && !Sentry.configuration.skip_rake_integration
13
13
 
14
14
  orig_display_error_messsage(ex)
15
15
  end
@@ -1,3 +1,3 @@
1
1
  module Sentry
2
- VERSION = "4.5.0-beta.1"
2
+ VERSION = "4.6.0"
3
3
  end
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = spec.homepage
19
- spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/sentry-ruby/CHANGELOG.md"
19
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
20
20
 
21
21
  spec.bindir = "exe"
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
data/sentry-ruby.gemspec CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
 
16
16
  spec.metadata["homepage_uri"] = spec.homepage
17
17
  spec.metadata["source_code_uri"] = spec.homepage
18
- spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/sentry-ruby/CHANGELOG.md"
18
+ spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/master/CHANGELOG.md"
19
19
 
20
20
  spec.add_dependency "sentry-ruby-core", Sentry::VERSION
21
21
  spec.add_dependency "faraday", ">= 1.0"
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.5.0.pre.beta.1
4
+ version: 4.6.0
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-05-27 00:00:00.000000000 Z
11
+ date: 2021-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -46,7 +46,6 @@ extra_rdoc_files:
46
46
  - README.md
47
47
  - LICENSE.txt
48
48
  files:
49
- - ".craft.yml"
50
49
  - ".gitignore"
51
50
  - ".rspec"
52
51
  - CHANGELOG.md
@@ -61,7 +60,6 @@ files:
61
60
  - lib/sentry-ruby.rb
62
61
  - lib/sentry/background_worker.rb
63
62
  - lib/sentry/backtrace.rb
64
- - lib/sentry/benchmarks/benchmark_transport.rb
65
63
  - lib/sentry/breadcrumb.rb
66
64
  - lib/sentry/breadcrumb/sentry_logger.rb
67
65
  - lib/sentry/breadcrumb_buffer.rb
@@ -86,7 +84,6 @@ files:
86
84
  - lib/sentry/net/http.rb
87
85
  - lib/sentry/rack.rb
88
86
  - lib/sentry/rack/capture_exceptions.rb
89
- - lib/sentry/rack/deprecations.rb
90
87
  - lib/sentry/rake.rb
91
88
  - lib/sentry/scope.rb
92
89
  - lib/sentry/span.rb
@@ -110,7 +107,7 @@ licenses:
110
107
  metadata:
111
108
  homepage_uri: https://github.com/getsentry/sentry-ruby
112
109
  source_code_uri: https://github.com/getsentry/sentry-ruby
113
- changelog_uri: https://github.com/getsentry/sentry-ruby/blob/master/sentry-ruby/CHANGELOG.md
110
+ changelog_uri: https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md
114
111
  post_install_message:
115
112
  rdoc_options: []
116
113
  require_paths:
@@ -122,9 +119,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
119
  version: '2.4'
123
120
  required_rubygems_version: !ruby/object:Gem::Requirement
124
121
  requirements:
125
- - - ">"
122
+ - - ">="
126
123
  - !ruby/object:Gem::Version
127
- version: 1.3.1
124
+ version: '0'
128
125
  requirements: []
129
126
  rubygems_version: 3.1.6
130
127
  signing_key:
data/.craft.yml DELETED
@@ -1,28 +0,0 @@
1
- minVersion: '0.13.2'
2
- github:
3
- owner: getsentry
4
- repo: sentry-ruby
5
- changelogPolicy: simple
6
- preReleaseCommand: ruby ../.scripts/bump-version.rb
7
- releaseBranchPrefix: release-sentry-ruby
8
- statusProvider:
9
- name: github
10
- artifactProvider:
11
- name: github
12
- targets:
13
- # we always need to make sure sentry-ruby-core is present when pushing to any target
14
- - name: gem
15
- onlyIfPresent: /^sentry-ruby-core-\d.*\.gem$/
16
- - name: registry
17
- onlyIfPresent: /^sentry-ruby-core-\d.*\.gem$/
18
- type: sdk
19
- config:
20
- canonical: 'gem:sentry-ruby'
21
- - name: registry
22
- onlyIfPresent: /^sentry-ruby-core-\d.*\.gem$/
23
- type: sdk
24
- config:
25
- canonical: 'gem:sentry-ruby-core'
26
- - name: github
27
- onlyIfPresent: /^sentry-ruby-core-\d.*\.gem$/
28
- tagPrefix: sentry-ruby-v
@@ -1,14 +0,0 @@
1
- module Sentry
2
- class BenchmarkTransport < Transport
3
- attr_accessor :events
4
-
5
- def initialize(*)
6
- super
7
- @events = []
8
- end
9
-
10
- def send_event(event)
11
- @events << encode(event.to_hash)
12
- end
13
- end
14
- end
@@ -1,19 +0,0 @@
1
- module Sentry
2
- module Rack
3
- class DeprecatedMiddleware
4
- def initialize(_)
5
- raise Sentry::Error.new <<~MSG
6
-
7
- You're seeing this message because #{self.class} has been replaced by Sentry::Rack::CaptureExceptions.
8
- Removing this middleware from your app and upgrading sentry-rails to 4.1.0+ should solve the issue.
9
- MSG
10
- end
11
- end
12
-
13
- class Tracing < DeprecatedMiddleware
14
- end
15
-
16
- class CaptureException < DeprecatedMiddleware
17
- end
18
- end
19
- end