sentry-ruby-core 4.2.1 → 4.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +19 -33
- data/lib/sentry/event.rb +1 -0
- data/lib/sentry/interfaces/single_exception.rb +1 -0
- data/lib/sentry/utils/real_ip.rb +1 -1
- data/lib/sentry/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 927808cee7826c8aa7535511858722699330cd16b430ad68b7a7b79aaf04546d
|
4
|
+
data.tar.gz: 779f0e49611a24e1149fa551ff8988e15ac684bb2e9eb0c70a6c96b33501086d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d629d892096a9de47f89f62c62487eb536c059c0ce14f6263aa605b50c2eddd0d5ecb48ed5da094444e58a889b8800b3333456cfa3c5e3e6afd4b6ea0512f081
|
7
|
+
data.tar.gz: 19a781d62efd5af40367146c976e2a1d886c59fbeddc6d67ad3e4efee15744ef34efd0769abb39317ee6b94d768394f7a6cf468a539d44894e595bd384ffc4cb
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 4.2.2
|
4
|
+
|
5
|
+
- Add thread_id to Exception interface [#1291](https://github.com/getsentry/sentry-ruby/pull/1291)
|
6
|
+
- always convert trusted proxies to string [#1288](https://github.com/getsentry/sentry-ruby/pull/1288)
|
7
|
+
- fixes [#1274](https://github.com/getsentry/sentry-ruby/issues/1274)
|
8
|
+
|
3
9
|
## 4.2.1
|
4
10
|
|
5
11
|
### Bug Fixes
|
data/README.md
CHANGED
@@ -26,7 +26,7 @@ The official Ruby-language client and integration layer for the [Sentry](https:/
|
|
26
26
|
|
27
27
|
## Requirements
|
28
28
|
|
29
|
-
We test on Ruby 2.4, 2.5, 2.6
|
29
|
+
We test on Ruby 2.4, 2.5, 2.6, 2.7, and 3.0 at the latest patchlevel/teeny version. We also support JRuby 9.0.
|
30
30
|
|
31
31
|
If you use self-hosted Sentry, please also make sure its version is above `20.6.0`.
|
32
32
|
|
@@ -47,6 +47,7 @@ and depends on the integrations you want to have, you might also want to install
|
|
47
47
|
```ruby
|
48
48
|
gem "sentry-rails"
|
49
49
|
gem "sentry-sidekiq"
|
50
|
+
gem "sentry-delayed_job"
|
50
51
|
# and mores to come in the future!
|
51
52
|
```
|
52
53
|
|
@@ -136,6 +137,7 @@ We also provide integrations with popular frameworks/libraries with the related
|
|
136
137
|
|
137
138
|
- [sentry-rails](https://github.com/getsentry/sentry-ruby/tree/master/sentry-rails)
|
138
139
|
- [sentry-sidekiq](https://github.com/getsentry/sentry-ruby/tree/master/sentry-sidekiq)
|
140
|
+
- [sentry-delayed_job](https://github.com/getsentry/sentry-ruby/tree/master/sentry-delayed_job)
|
139
141
|
|
140
142
|
### More configuration
|
141
143
|
|
@@ -143,38 +145,7 @@ You're all set - but there's a few more settings you may want to know about too!
|
|
143
145
|
|
144
146
|
#### Blocking v.s. Non-blocking
|
145
147
|
|
146
|
-
|
147
|
-
|
148
|
-
```ruby
|
149
|
-
config.async = lambda { |event, hint|
|
150
|
-
Thread.new { Sentry.send_event(event, hint) }
|
151
|
-
}
|
152
|
-
```
|
153
|
-
|
154
|
-
Using a thread to send events will be adequate for truly parallel Ruby platforms such as JRuby, though the benefit on MRI/CRuby will be limited. If the async callback raises an exception, Sentry will attempt to send synchronously.
|
155
|
-
|
156
|
-
Note that the naive example implementation has a major drawback - it can create an infinite number of threads. We recommend creating a background job, using your background job processor, that will send Sentry notifications in the background.
|
157
|
-
|
158
|
-
```ruby
|
159
|
-
config.async = lambda { |event, hint| SentryJob.perform_later(event, hint) }
|
160
|
-
|
161
|
-
class SentryJob < ActiveJob::Base
|
162
|
-
queue_as :default
|
163
|
-
discard_on ActiveJob::DeserializationError # this will prevent infinite loop when there's an issue deserializing SentryJob
|
164
|
-
|
165
|
-
def perform(event, hint)
|
166
|
-
Sentry.send_event(event, hint)
|
167
|
-
end
|
168
|
-
end
|
169
|
-
```
|
170
|
-
|
171
|
-
If you also use `sentry-rails`, you can directly use the job we defined for you:
|
172
|
-
|
173
|
-
```ruby
|
174
|
-
config.async = lambda { |event, hint| Sentry::SendEventJob.perform_later(event, hint) }
|
175
|
-
```
|
176
|
-
|
177
|
-
**After version 4.1.0**, `sentry-ruby` sends events asynchronously by default. The functionality works like this:
|
148
|
+
`sentry-ruby` sends events asynchronously by default. The functionality works like this:
|
178
149
|
|
179
150
|
1. When the SDK is initialized, a `Sentry::BackgroundWorker` will be initialized too.
|
180
151
|
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.
|
@@ -208,6 +179,21 @@ If you want to send a particular event immediately, you can use event hints to d
|
|
208
179
|
Sentry.capture_message("send me now!", hint: { background: false })
|
209
180
|
```
|
210
181
|
|
182
|
+
##### `config.async`
|
183
|
+
|
184
|
+
You can also use `config.async` to send events with you own worker:
|
185
|
+
|
186
|
+
```ruby
|
187
|
+
config.async = lambda { |event, hint| SentryJob.perform_later(event, hint) }
|
188
|
+
```
|
189
|
+
|
190
|
+
And if you use `sentry-rails`, you can directly use the job we defined for you:
|
191
|
+
|
192
|
+
```ruby
|
193
|
+
config.async = lambda { |event, hint| Sentry::SendEventJob.perform_later(event, hint) }
|
194
|
+
```
|
195
|
+
|
196
|
+
|
211
197
|
#### Contexts
|
212
198
|
|
213
199
|
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:
|
data/lib/sentry/event.rb
CHANGED
@@ -133,6 +133,7 @@ module Sentry
|
|
133
133
|
int.type = e.class.to_s
|
134
134
|
int.value = e.message.byteslice(0..MAX_MESSAGE_SIZE_IN_BYTES)
|
135
135
|
int.module = e.class.to_s.split('::')[0...-1].join('::')
|
136
|
+
int.thread_id = Thread.current.object_id
|
136
137
|
|
137
138
|
int.stacktrace =
|
138
139
|
if e.backtrace && !backtraces.include?(e.backtrace.object_id)
|
data/lib/sentry/utils/real_ip.rb
CHANGED
@@ -29,7 +29,7 @@ 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) }.uniq
|
32
|
+
@trusted_proxies = (LOCAL_ADDRESSES + Array(trusted_proxies)).map { |proxy| IPAddr.new(proxy.to_s) }.uniq
|
33
33
|
end
|
34
34
|
|
35
35
|
def calculate_ip
|
data/lib/sentry/version.rb
CHANGED
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.2.
|
4
|
+
version: 4.2.2
|
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-02-
|
11
|
+
date: 2021-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|