sentry-ruby 4.4.0 → 5.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +29 -175
- metadata +7 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec1d99fa7ee26d45ec79cfe7feb5f51320444d2f85c82fddbc4cfcff032d1f33
|
4
|
+
data.tar.gz: 9d9622342e227d2d10bd2c6857d3c639991f9125eb6487e263a7897be256d860
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 796f162a24f365593e7daeacd3f6c1ef2fb706e431b0204556a1e874f546d071fffbc28f23a2a74771f7c12f2db4d2dd5c4d7e87a85cbcf69a5528ed4de3e1c2
|
7
|
+
data.tar.gz: a43c074c3478643375bc664f3aff47db5f1bfe119d7733f1d1b45b6d5762ff627078de1e91feebe93adeb9204593d7bb36a690d0633abe230419eb2314804f76
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -10,12 +10,13 @@ _Bad software is everywhere, and we're tired of it. Sentry is on a mission to he
|
|
10
10
|
Sentry SDK for Ruby
|
11
11
|
===========
|
12
12
|
|
13
|
-
| current version | build | coverage | downloads |
|
14
|
-
| --- | ----- | -------- | --------- |
|
15
|
-
| [![Gem Version](https://img.shields.io/gem/v/sentry-ruby?label=sentry-ruby)](https://
|
16
|
-
| [![Gem Version](https://img.shields.io/gem/v/sentry-rails?label=sentry-rails)](https://
|
17
|
-
| [![Gem Version](https://img.shields.io/gem/v/sentry-sidekiq?label=sentry-sidekiq)](https://
|
18
|
-
| [![Gem Version](https://img.shields.io/gem/v/sentry-delayed_job?label=sentry-delayed_job)](https://
|
13
|
+
| current version | build | coverage | downloads |
|
14
|
+
| --- | ----- | -------- | --------- |
|
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/) |
|
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/) |
|
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/) |
|
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/) |
|
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/) |
|
19
20
|
|
20
21
|
|
21
22
|
|
@@ -46,200 +47,53 @@ 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
|
-
|
50
|
+
gem "sentry-resque"
|
50
51
|
```
|
51
52
|
|
52
|
-
###
|
53
|
+
### Configuration
|
53
54
|
|
54
|
-
|
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 =
|
59
|
+
config.dsn = "MY_DSN"
|
64
60
|
end
|
65
|
-
```
|
66
|
-
|
67
|
-
### Sentry doesn't report some kinds of data by default
|
68
|
-
|
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
61
|
|
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
|
-
#
|
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
|
95
|
-
end
|
96
|
-
```
|
97
|
-
|
98
|
-
To learn more about performance monitoring, please visit the [official documentation](https://docs.sentry.io/platforms/ruby/performance).
|
99
|
-
|
100
|
-
### Usage
|
101
|
-
|
102
|
-
`sentry-ruby` has a default integration with `Rack`, so you only need to use the middleware in your application like:
|
103
|
-
|
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
|
-
```
|
173
|
-
|
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)
|
74
|
+
# you can also use traces_sampler for more fine-grained sampling
|
75
|
+
# please click the link below to learn more
|
208
76
|
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
77
|
```
|
221
78
|
|
222
|
-
|
223
|
-
|
224
|
-
```ruby
|
225
|
-
Sentry.configure_scope do |scope|
|
226
|
-
scope.set_tags(tag_1: "foo")
|
227
|
-
end
|
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).
|
228
80
|
|
229
|
-
|
230
|
-
scope.set_tags(tag_1: "bar", tag_2: "baz")
|
81
|
+
### [Migration Guide](https://docs.sentry.io/platforms/ruby/migration/)
|
231
82
|
|
232
|
-
|
233
|
-
end
|
83
|
+
### Integrations
|
234
84
|
|
235
|
-
|
236
|
-
|
85
|
+
- [Rack](https://docs.sentry.io/platforms/ruby/guides/rack/)
|
86
|
+
- [Rails](https://docs.sentry.io/platforms/ruby/guides/rails/)
|
87
|
+
- [Sidekiq](https://docs.sentry.io/platforms/ruby/guides/sidekiq/)
|
88
|
+
- [DelayedJob](https://docs.sentry.io/platforms/ruby/guides/delayed_job/)
|
89
|
+
- [Resque](https://docs.sentry.io/platforms/ruby/guides/resque/)
|
237
90
|
|
238
|
-
|
91
|
+
### Enriching Events
|
239
92
|
|
240
|
-
|
241
|
-
|
242
|
-
|
93
|
+
- [Add more data to the current scope](https://docs.sentry.io/platforms/ruby/guides/rack/enriching-events/scopes/)
|
94
|
+
- [Add custom breadcrumbs](https://docs.sentry.io/platforms/ruby/guides/rack/enriching-events/breadcrumbs/)
|
95
|
+
- [Add contextual data](https://docs.sentry.io/platforms/ruby/guides/rack/enriching-events/context/)
|
96
|
+
- [Add tags](https://docs.sentry.io/platforms/ruby/guides/rack/enriching-events/tags/)
|
243
97
|
|
244
98
|
## Resources
|
245
99
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sentry-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.2
|
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: 2022-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sentry-ruby-core
|
@@ -16,28 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.0.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: faraday
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.0'
|
26
|
+
version: 5.0.2
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: concurrent-ruby
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,11 +56,11 @@ files:
|
|
70
56
|
- README.md
|
71
57
|
homepage: https://github.com/getsentry/sentry-ruby
|
72
58
|
licenses:
|
73
|
-
-
|
59
|
+
- MIT
|
74
60
|
metadata:
|
75
61
|
homepage_uri: https://github.com/getsentry/sentry-ruby
|
76
62
|
source_code_uri: https://github.com/getsentry/sentry-ruby
|
77
|
-
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/master/
|
63
|
+
changelog_uri: https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md
|
78
64
|
post_install_message:
|
79
65
|
rdoc_options: []
|
80
66
|
require_paths:
|
@@ -90,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
76
|
- !ruby/object:Gem::Version
|
91
77
|
version: '0'
|
92
78
|
requirements: []
|
93
|
-
rubygems_version: 3.
|
79
|
+
rubygems_version: 3.1.6
|
94
80
|
signing_key:
|
95
81
|
specification_version: 4
|
96
82
|
summary: A gem that provides a client interface for the Sentry error logger
|