sentry-ruby 5.3.0 → 5.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.yardopts +2 -0
- data/CHANGELOG.md +313 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +31 -0
- data/Makefile +4 -0
- data/README.md +10 -6
- data/Rakefile +13 -0
- data/bin/console +18 -0
- data/bin/setup +8 -0
- data/lib/sentry/background_worker.rb +72 -0
- data/lib/sentry/backtrace.rb +124 -0
- data/lib/sentry/baggage.rb +81 -0
- data/lib/sentry/breadcrumb/sentry_logger.rb +90 -0
- data/lib/sentry/breadcrumb.rb +70 -0
- data/lib/sentry/breadcrumb_buffer.rb +64 -0
- data/lib/sentry/client.rb +207 -0
- data/lib/sentry/configuration.rb +543 -0
- data/lib/sentry/core_ext/object/deep_dup.rb +61 -0
- data/lib/sentry/core_ext/object/duplicable.rb +155 -0
- data/lib/sentry/dsn.rb +53 -0
- data/lib/sentry/envelope.rb +96 -0
- data/lib/sentry/error_event.rb +38 -0
- data/lib/sentry/event.rb +178 -0
- data/lib/sentry/exceptions.rb +9 -0
- data/lib/sentry/hub.rb +241 -0
- data/lib/sentry/integrable.rb +26 -0
- data/lib/sentry/interface.rb +16 -0
- data/lib/sentry/interfaces/exception.rb +43 -0
- data/lib/sentry/interfaces/request.rb +134 -0
- data/lib/sentry/interfaces/single_exception.rb +65 -0
- data/lib/sentry/interfaces/stacktrace.rb +87 -0
- data/lib/sentry/interfaces/stacktrace_builder.rb +79 -0
- data/lib/sentry/interfaces/threads.rb +42 -0
- data/lib/sentry/linecache.rb +47 -0
- data/lib/sentry/logger.rb +20 -0
- data/lib/sentry/net/http.rb +103 -0
- data/lib/sentry/rack/capture_exceptions.rb +82 -0
- data/lib/sentry/rack.rb +5 -0
- data/lib/sentry/rake.rb +41 -0
- data/lib/sentry/redis.rb +107 -0
- data/lib/sentry/release_detector.rb +39 -0
- data/lib/sentry/scope.rb +339 -0
- data/lib/sentry/session.rb +33 -0
- data/lib/sentry/session_flusher.rb +90 -0
- data/lib/sentry/span.rb +236 -0
- data/lib/sentry/test_helper.rb +78 -0
- data/lib/sentry/transaction.rb +345 -0
- data/lib/sentry/transaction_event.rb +53 -0
- data/lib/sentry/transport/configuration.rb +25 -0
- data/lib/sentry/transport/dummy_transport.rb +21 -0
- data/lib/sentry/transport/http_transport.rb +175 -0
- data/lib/sentry/transport.rb +214 -0
- data/lib/sentry/utils/argument_checking_helper.rb +13 -0
- data/lib/sentry/utils/custom_inspection.rb +14 -0
- data/lib/sentry/utils/encoding_helper.rb +22 -0
- data/lib/sentry/utils/exception_cause_chain.rb +20 -0
- data/lib/sentry/utils/logging_helper.rb +26 -0
- data/lib/sentry/utils/real_ip.rb +84 -0
- data/lib/sentry/utils/request_id.rb +18 -0
- data/lib/sentry/version.rb +5 -0
- data/lib/sentry-ruby.rb +511 -0
- data/sentry-ruby-core.gemspec +23 -0
- data/sentry-ruby.gemspec +24 -0
- metadata +66 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ced2a96562a5dc27766fb35a62e43f302dd46eeabd16eae2a52106cc2151ee0
|
4
|
+
data.tar.gz: 14f4b9a532cc0d1f401ee0bcb942787951f107358e9fbfadc2b1c655d00da3b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8816a3439fd547d260e538d16c3db3f440bbdae35ec8108e2338ccd712497cbca0413ce1a365862ab510a787f5d3cae8a58eab2273dd06588284d77a5afac898
|
7
|
+
data.tar.gz: 4d5e8d3fe56644431b33fbec3eeaf4ceec01eb85b21bd2abfa5a0d8bc4c812aef9beb06b89048525186f00170677b160154414d5cb9b8972725532ba35277130
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,313 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
Individual gem's changelog has been deprecated. Please check the [project changelog](https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md).
|
4
|
+
|
5
|
+
## 4.4.2
|
6
|
+
|
7
|
+
- Fix NoMethodError when SDK's dsn is nil [#1433](https://github.com/getsentry/sentry-ruby/pull/1433)
|
8
|
+
- fix: Update protocol version to 7 [#1434](https://github.com/getsentry/sentry-ruby/pull/1434)
|
9
|
+
- Fixes [#867](https://github.com/getsentry/sentry-ruby/issues/867)
|
10
|
+
|
11
|
+
## 4.4.1
|
12
|
+
|
13
|
+
- Apply patches when initializing the SDK [#1432](https://github.com/getsentry/sentry-ruby/pull/1432)
|
14
|
+
|
15
|
+
## 4.4.0
|
16
|
+
|
17
|
+
### Features
|
18
|
+
|
19
|
+
#### Support category-based rate limiting [#1336](https://github.com/getsentry/sentry-ruby/pull/1336)
|
20
|
+
|
21
|
+
Sentry rate limits different types of events. And when rate limiting is enabled, it sends back a `429` response to the SDK. Currently, the SDK would then raise an error like this:
|
22
|
+
|
23
|
+
```
|
24
|
+
Unable to record event with remote Sentry server (Sentry::Error - the server responded with status 429
|
25
|
+
body: {"detail":"event rejected due to rate limit"}):
|
26
|
+
```
|
27
|
+
|
28
|
+
This change improves the SDK's handling on such responses by:
|
29
|
+
|
30
|
+
- Not treating them as errors, so you don't see the noise anymore.
|
31
|
+
- Halting event sending for a while according to the duration provided in the response. And warns you with a message like:
|
32
|
+
|
33
|
+
```
|
34
|
+
Envelope [event] not sent: Excluded by random sample
|
35
|
+
```
|
36
|
+
|
37
|
+
#### Record request span from Net::HTTP library [#1381](https://github.com/getsentry/sentry-ruby/pull/1381)
|
38
|
+
|
39
|
+
Now any outgoing requests will be recorded as a tracing span. Example:
|
40
|
+
|
41
|
+
<img width="60%" alt="net:http span example" src="https://user-images.githubusercontent.com/5079556/115838944-c1279a80-a44c-11eb-8c67-dfd92bf68bbd.png">
|
42
|
+
|
43
|
+
|
44
|
+
#### Record breadcrumb for Net::HTTP requests [#1394](https://github.com/getsentry/sentry-ruby/pull/1394)
|
45
|
+
|
46
|
+
With the new `http_logger` breadcrumbs logger:
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
config.breadcrumbs_logger = [:http_logger]
|
50
|
+
```
|
51
|
+
|
52
|
+
The SDK now records a new `net.http` breadcrumb whenever the user makes a request with the `Net::HTTP` library.
|
53
|
+
|
54
|
+
<img width="60%" alt="net http breadcrumb" src="https://user-images.githubusercontent.com/5079556/114298326-5f7c3d80-9ae8-11eb-9108-222384a7f1a2.png">
|
55
|
+
|
56
|
+
#### Support config.debug configuration option [#1400](https://github.com/getsentry/sentry-ruby/pull/1400)
|
57
|
+
|
58
|
+
It'll determine whether the SDK should run in the debugging mode. Default is `false`. When set to true, SDK errors will be logged with backtrace.
|
59
|
+
|
60
|
+
#### Add the third tracing state [#1402](https://github.com/getsentry/sentry-ruby/pull/1402)
|
61
|
+
- `rate == 0` - Tracing enabled. Rejects all locally created transactions but respects sentry-trace.
|
62
|
+
- `1 > rate > 0` - Tracing enabled. Samples locally created transactions with the rate and respects sentry-trace.
|
63
|
+
- `rate < 0` or `rate > 1` - Tracing disabled.
|
64
|
+
|
65
|
+
### Refactorings
|
66
|
+
|
67
|
+
- Let Transaction constructor take an optional hub argument [#1384](https://github.com/getsentry/sentry-ruby/pull/1384)
|
68
|
+
- Introduce LoggingHelper [#1385](https://github.com/getsentry/sentry-ruby/pull/1385)
|
69
|
+
- Raise exception if a Transaction is initialized without a hub [#1391](https://github.com/getsentry/sentry-ruby/pull/1391)
|
70
|
+
- Make hub a required argument for Transaction constructor [#1401](https://github.com/getsentry/sentry-ruby/pull/1401)
|
71
|
+
|
72
|
+
### Bug Fixes
|
73
|
+
|
74
|
+
- Check `Scope#set_context`'s value argument [#1415](https://github.com/getsentry/sentry-ruby/pull/1415)
|
75
|
+
- Disable tracing if events are not allowed to be sent [#1421](https://github.com/getsentry/sentry-ruby/pull/1421)
|
76
|
+
|
77
|
+
## 4.3.2
|
78
|
+
|
79
|
+
- Correct type attribute's usages [#1354](https://github.com/getsentry/sentry-ruby/pull/1354)
|
80
|
+
- Fix sampling decision precedence [#1335](https://github.com/getsentry/sentry-ruby/pull/1335)
|
81
|
+
- Fix set_contexts [#1375](https://github.com/getsentry/sentry-ruby/pull/1375)
|
82
|
+
- Use thread variable instead of fiber variable to store the hub [#1380](https://github.com/getsentry/sentry-ruby/pull/1380)
|
83
|
+
- Fixes [#1374](https://github.com/getsentry/sentry-ruby/issues/1374)
|
84
|
+
- Fix Span/Transaction's nesting issue [#1382](https://github.com/getsentry/sentry-ruby/pull/1382)
|
85
|
+
- Fixes [#1372](https://github.com/getsentry/sentry-ruby/issues/1372)
|
86
|
+
|
87
|
+
## 4.3.1
|
88
|
+
|
89
|
+
- Add Sentry.set_context helper [#1337](https://github.com/getsentry/sentry-ruby/pull/1337)
|
90
|
+
- Fix handle the case where the logger messages is not of String type [#1341](https://github.com/getsentry/sentry-ruby/pull/1341)
|
91
|
+
- Don't report Sentry::ExternalError to Sentry [#1353](https://github.com/getsentry/sentry-ruby/pull/1353)
|
92
|
+
- Sentry.add_breadcrumb should call Hub#add_breadcrumb [#1358](https://github.com/getsentry/sentry-ruby/pull/1358)
|
93
|
+
- Fixes [#1357](https://github.com/getsentry/sentry-ruby/issues/1357)
|
94
|
+
|
95
|
+
## 4.3.0
|
96
|
+
|
97
|
+
### Features
|
98
|
+
|
99
|
+
- Allow configuring BreadcrumbBuffer's size limit [#1310](https://github.com/getsentry/sentry-ruby/pull/1310)
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
# the SDK will only store 10 breadcrumbs (default is 100)
|
103
|
+
config.max_breadcrumbs = 10
|
104
|
+
```
|
105
|
+
|
106
|
+
- Compress event payload by default [#1314](https://github.com/getsentry/sentry-ruby/pull/1314)
|
107
|
+
|
108
|
+
### Refatorings
|
109
|
+
|
110
|
+
- Refactor interface construction [#1296](https://github.com/getsentry/sentry-ruby/pull/1296)
|
111
|
+
- Refactor tracing implementation [#1309](https://github.com/getsentry/sentry-ruby/pull/1309)
|
112
|
+
|
113
|
+
### Bug Fixes
|
114
|
+
- Improve SDK's error handling [#1298](https://github.com/getsentry/sentry-ruby/pull/1298)
|
115
|
+
- Fixes [#1246](https://github.com/getsentry/sentry-ruby/issues/1246) and [#1289](https://github.com/getsentry/sentry-ruby/issues/1289)
|
116
|
+
- Please read [#1290](https://github.com/getsentry/sentry-ruby/issues/1290) to see the full specification
|
117
|
+
- Treat query string as pii too [#1302](https://github.com/getsentry/sentry-ruby/pull/1302)
|
118
|
+
- Fixes [#1301](https://github.com/getsentry/sentry-ruby/issues/1301)
|
119
|
+
- Ignore sentry-trace when tracing is not enabled [#1308](https://github.com/getsentry/sentry-ruby/pull/1308)
|
120
|
+
- Fixes [#1307](https://github.com/getsentry/sentry-ruby/issues/1307)
|
121
|
+
- Return nil from logger methods instead of breadcrumb buffer [#1299](https://github.com/getsentry/sentry-ruby/pull/1299)
|
122
|
+
- Exceptions with nil message shouldn't cause issues [#1327](https://github.com/getsentry/sentry-ruby/pull/1327)
|
123
|
+
- Fixes [#1323](https://github.com/getsentry/sentry-ruby/issues/1323)
|
124
|
+
- Fix sampling decision with sentry-trace and add more tests [#1326](https://github.com/getsentry/sentry-ruby/pull/1326)
|
125
|
+
|
126
|
+
## 4.2.2
|
127
|
+
|
128
|
+
- Add thread_id to Exception interface [#1291](https://github.com/getsentry/sentry-ruby/pull/1291)
|
129
|
+
- always convert trusted proxies to string [#1288](https://github.com/getsentry/sentry-ruby/pull/1288)
|
130
|
+
- fixes [#1274](https://github.com/getsentry/sentry-ruby/issues/1274)
|
131
|
+
|
132
|
+
## 4.2.1
|
133
|
+
|
134
|
+
### Bug Fixes
|
135
|
+
|
136
|
+
- Ignore invalid values for sentry-trace header that don't match the required format [#1265](https://github.com/getsentry/sentry-ruby/pull/1265)
|
137
|
+
- Transaction created by `.from_sentry_trace` should inherit sampling decision [#1269](https://github.com/getsentry/sentry-ruby/pull/1269)
|
138
|
+
- Transaction's sample rate should accept any numeric value [#1278](https://github.com/getsentry/sentry-ruby/pull/1278)
|
139
|
+
|
140
|
+
## 4.2.0
|
141
|
+
|
142
|
+
### Features
|
143
|
+
|
144
|
+
- Add configuration option for trusted proxies [#1126](https://github.com/getsentry/sentry-ruby/pull/1126)
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
config.trusted_proxies = ["2.2.2.2"] # this ip address will be skipped when computing users' ip addresses
|
148
|
+
```
|
149
|
+
|
150
|
+
- Add ThreadsInterface [#1178](https://github.com/getsentry/sentry-ruby/pull/1178)
|
151
|
+
|
152
|
+
<img width="1029" alt="an exception event that has the new threads interface" src="https://user-images.githubusercontent.com/5079556/103459223-98b64c00-4d48-11eb-9ebb-ee58f15e647e.png">
|
153
|
+
|
154
|
+
- Support `config.before_breadcrumb` [#1253](https://github.com/getsentry/sentry-ruby/pull/1253)
|
155
|
+
|
156
|
+
```ruby
|
157
|
+
# this will be called before every breadcrumb is added to the breadcrumb buffer
|
158
|
+
# you can use it to
|
159
|
+
# - remove the data you don't want to send
|
160
|
+
# - add additional info to the data
|
161
|
+
config.before_breadcrumb = lambda do |breadcrumb, hint|
|
162
|
+
breadcrumb.message = "foo"
|
163
|
+
breadcrumb
|
164
|
+
end
|
165
|
+
```
|
166
|
+
|
167
|
+
- Add ability to have many post initialization callbacks [#1261](https://github.com/getsentry/sentry-ruby/pull/1261)
|
168
|
+
|
169
|
+
### Bug Fixes
|
170
|
+
|
171
|
+
- Inspect exception cause by default & don't exclude ActiveJob::DeserializationError [#1180](https://github.com/getsentry/sentry-ruby/pull/1180)
|
172
|
+
- Fixes [#1071](https://github.com/getsentry/sentry-ruby/issues/1071)
|
173
|
+
|
174
|
+
## 4.1.6
|
175
|
+
|
176
|
+
- Don't detect project root for Rails apps [#1243](https://github.com/getsentry/sentry-ruby/pull/1243)
|
177
|
+
- Separate individual breadcrumb's data serialization [#1250](https://github.com/getsentry/sentry-ruby/pull/1250)
|
178
|
+
- Capture sentry-trace with the correct http header key [#1260](https://github.com/getsentry/sentry-ruby/pull/1260)
|
179
|
+
|
180
|
+
## 4.1.5
|
181
|
+
|
182
|
+
- Serialize event hint before passing it to the async block [#1231](https://github.com/getsentry/sentry-ruby/pull/1231)
|
183
|
+
- Fixes [#1227](https://github.com/getsentry/sentry-ruby/issues/1227)
|
184
|
+
- Require the English library [#1233](https://github.com/getsentry/sentry-ruby/pull/1233) (by @dentarg)
|
185
|
+
- Allow `Sentry.init` without block argument [#1235](https://github.com/getsentry/sentry-ruby/pull/1235) (by @sue445)
|
186
|
+
|
187
|
+
## 4.1.5-beta.1
|
188
|
+
|
189
|
+
- No change
|
190
|
+
|
191
|
+
## 4.1.5-beta.0
|
192
|
+
|
193
|
+
- Inline global method [#1213](https://github.com/getsentry/sentry-ruby/pull/1213) (by @tricknotes)
|
194
|
+
- Event message and exception message should have a size limit [#1221](https://github.com/getsentry/sentry-ruby/pull/1221)
|
195
|
+
- Add sentry-ruby-core as a more flexible option [#1226](https://github.com/getsentry/sentry-ruby/pull/1226)
|
196
|
+
|
197
|
+
## 4.1.4
|
198
|
+
|
199
|
+
- Fix headers serialization for sentry-ruby [#1197](https://github.com/getsentry/sentry-ruby/pull/1197) (by @moofkit)
|
200
|
+
- Support capturing "sentry-trace" header from the middleware [#1205](https://github.com/getsentry/sentry-ruby/pull/1205)
|
201
|
+
- Document public APIs on the Sentry module [#1208](https://github.com/getsentry/sentry-ruby/pull/1208)
|
202
|
+
- Check the argument type of capture_exception and capture_event helpers [#1209](https://github.com/getsentry/sentry-ruby/pull/1209)
|
203
|
+
|
204
|
+
## 4.1.3
|
205
|
+
|
206
|
+
- rm reference to old constant (from Rails v2.2) [#1184](https://github.com/getsentry/sentry-ruby/pull/1184)
|
207
|
+
- Use copied env in events [#1186](https://github.com/getsentry/sentry-ruby/pull/1186)
|
208
|
+
- Fixes [#1183](https://github.com/getsentry/sentry-ruby/issues/1183)
|
209
|
+
- Refactor RequestInterface [#1187](https://github.com/getsentry/sentry-ruby/pull/1187)
|
210
|
+
- Supply event hint to async callback when possible [#1189](https://github.com/getsentry/sentry-ruby/pull/1189)
|
211
|
+
- Fixes [#1188](https://github.com/getsentry/sentry-ruby/issues/1188)
|
212
|
+
- Refactor stacktrace parsing and increase test coverage [#1190](https://github.com/getsentry/sentry-ruby/pull/1190)
|
213
|
+
- Sentry.send_event should also take a hint [#1192](https://github.com/getsentry/sentry-ruby/pull/1192)
|
214
|
+
|
215
|
+
## 4.1.2
|
216
|
+
|
217
|
+
- before_send callback shouldn't be applied to transaction events [#1167](https://github.com/getsentry/sentry-ruby/pull/1167)
|
218
|
+
- Transaction improvements [#1170](https://github.com/getsentry/sentry-ruby/pull/1170)
|
219
|
+
- Support Ruby 3 [#1172](https://github.com/getsentry/sentry-ruby/pull/1172)
|
220
|
+
- Add Integrable module [#1177](https://github.com/getsentry/sentry-ruby/pull/1177)
|
221
|
+
|
222
|
+
## 4.1.1
|
223
|
+
|
224
|
+
- Fix NoMethodError when sending is not allowed [#1161](https://github.com/getsentry/sentry-ruby/pull/1161)
|
225
|
+
- Add notification for users who still use deprecated middlewares [#1160](https://github.com/getsentry/sentry-ruby/pull/1160)
|
226
|
+
- Improve top-level api safety [#1162](https://github.com/getsentry/sentry-ruby/pull/1162)
|
227
|
+
|
228
|
+
## 4.1.0
|
229
|
+
|
230
|
+
- Separate rack integration [#1138](https://github.com/getsentry/sentry-ruby/pull/1138)
|
231
|
+
- Fixes [#1136](https://github.com/getsentry/sentry-ruby/pull/1136)
|
232
|
+
- Fix event sampling [#1144](https://github.com/getsentry/sentry-ruby/pull/1144)
|
233
|
+
- Merge & rename 2 Rack middlewares [#1147](https://github.com/getsentry/sentry-ruby/pull/1147)
|
234
|
+
- Fixes [#1153](https://github.com/getsentry/sentry-ruby/pull/1153)
|
235
|
+
- Removed `Sentry::Rack::Tracing` middleware and renamed `Sentry::Rack::CaptureException` to `Sentry::Rack::CaptureExceptions`.
|
236
|
+
- Deep-copy spans [#1148](https://github.com/getsentry/sentry-ruby/pull/1148)
|
237
|
+
- Move span recorder related code from Span to Transaction [#1149](https://github.com/getsentry/sentry-ruby/pull/1149)
|
238
|
+
- Check SDK initialization before running integrations [#1151](https://github.com/getsentry/sentry-ruby/pull/1151)
|
239
|
+
- Fixes [#1145](https://github.com/getsentry/sentry-ruby/pull/1145)
|
240
|
+
- Refactor transport [#1154](https://github.com/getsentry/sentry-ruby/pull/1154)
|
241
|
+
- Implement non-blocking event sending [#1155](https://github.com/getsentry/sentry-ruby/pull/1155)
|
242
|
+
- Added `background_worker_threads` configuration option.
|
243
|
+
|
244
|
+
### Noticeable Changes
|
245
|
+
|
246
|
+
#### Middleware Changes
|
247
|
+
|
248
|
+
`Sentry::Rack::Tracing` is now removed. And `Sentry::Rack::CaptureException` has been renamed to `Sentry::Rack::CaptureExceptions`.
|
249
|
+
|
250
|
+
#### Events Are Sent Asynchronously
|
251
|
+
|
252
|
+
`sentry-ruby` now sends events asynchronously by default. The functionality works like this:
|
253
|
+
|
254
|
+
1. When the SDK is initialized, a `Sentry::BackgroundWorker` will be initialized too.
|
255
|
+
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.
|
256
|
+
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`.
|
257
|
+
- If all the threads are busy, new jobs will be put into a queue, which has a limit of 30.
|
258
|
+
- If the queue size is exceeded, new events will be dropped.
|
259
|
+
|
260
|
+
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.
|
261
|
+
|
262
|
+
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.
|
263
|
+
|
264
|
+
Of course, you can always override the value to fit your use cases, like
|
265
|
+
|
266
|
+
```ruby
|
267
|
+
config.background_worker_threads = 5 # the worker will have 5 threads for sending events
|
268
|
+
```
|
269
|
+
|
270
|
+
You can also disable this new non-blocking behaviour by giving a `0` value:
|
271
|
+
|
272
|
+
```ruby
|
273
|
+
config.background_worker_threads = 0 # all events will be sent synchronously
|
274
|
+
```
|
275
|
+
|
276
|
+
## 4.0.1
|
277
|
+
|
278
|
+
- Add rake integration: [1137](https://github.com/getsentry/sentry-ruby/pull/1137)
|
279
|
+
- Make Event's interfaces accessible: [1135](https://github.com/getsentry/sentry-ruby/pull/1135)
|
280
|
+
- ActiveSupportLogger should only record events that has a started time: [1132](https://github.com/getsentry/sentry-ruby/pull/1132)
|
281
|
+
|
282
|
+
## 4.0.0
|
283
|
+
|
284
|
+
- Only documents update for the official release and no API/feature changes.
|
285
|
+
|
286
|
+
## 0.3.0
|
287
|
+
|
288
|
+
- Major API changes: [1123](https://github.com/getsentry/sentry-ruby/pull/1123)
|
289
|
+
- Support event hint: [1122](https://github.com/getsentry/sentry-ruby/pull/1122)
|
290
|
+
- Add request-id tag to events: [1120](https://github.com/getsentry/sentry-ruby/pull/1120) (by @tvec)
|
291
|
+
|
292
|
+
## 0.2.0
|
293
|
+
|
294
|
+
- Multiple fixes and refactorings
|
295
|
+
- Tracing support
|
296
|
+
|
297
|
+
## 0.1.3
|
298
|
+
|
299
|
+
Fix require reference
|
300
|
+
|
301
|
+
## 0.1.2
|
302
|
+
|
303
|
+
- Fix: Fix async callback [1098](https://github.com/getsentry/sentry-ruby/pull/1098)
|
304
|
+
- Refactor: Some code cleanup [1100](https://github.com/getsentry/sentry-ruby/pull/1100)
|
305
|
+
- Refactor: Remove Event options [1101](https://github.com/getsentry/sentry-ruby/pull/1101)
|
306
|
+
|
307
|
+
## 0.1.1
|
308
|
+
|
309
|
+
- Feature: Allow passing custom scope to Hub#capture* helpers [1086](https://github.com/getsentry/sentry-ruby/pull/1086)
|
310
|
+
|
311
|
+
## 0.1.0
|
312
|
+
|
313
|
+
First version
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at stan001212@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
git_source(:github) { |name| "https://github.com/#{name}.git" }
|
3
|
+
|
4
|
+
gem "sentry-ruby", path: "./"
|
5
|
+
|
6
|
+
rack_version = ENV["RACK_VERSION"]
|
7
|
+
rack_version = "3.0.0" if rack_version.nil?
|
8
|
+
gem "rack", "~> #{Gem::Version.new(rack_version)}" unless rack_version == "0"
|
9
|
+
|
10
|
+
redis_rb_version = ENV.fetch("REDIS_RB_VERSION", "5.0")
|
11
|
+
gem "redis", "~> #{redis_rb_version}"
|
12
|
+
|
13
|
+
gem "rake", "~> 12.0"
|
14
|
+
gem "rspec", "~> 3.0"
|
15
|
+
gem "rspec-retry"
|
16
|
+
gem "timecop"
|
17
|
+
gem "simplecov"
|
18
|
+
gem "simplecov-cobertura", "~> 1.4"
|
19
|
+
gem "rexml"
|
20
|
+
|
21
|
+
gem "object_tracer"
|
22
|
+
gem "debug", github: "ruby/debug", platform: :ruby if RUBY_VERSION.to_f >= 2.6
|
23
|
+
gem "pry"
|
24
|
+
|
25
|
+
gem "benchmark-ips"
|
26
|
+
gem "benchmark_driver"
|
27
|
+
gem "benchmark-ipsa"
|
28
|
+
gem "benchmark-memory"
|
29
|
+
|
30
|
+
gem "yard", github: "lsegal/yard"
|
31
|
+
gem "webrick"
|
data/Makefile
ADDED
data/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
<p align="center">
|
2
|
-
<a href="https://sentry.io" target="_blank"
|
3
|
-
<
|
2
|
+
<a href="https://sentry.io/?utm_source=github&utm_medium=logo" target="_blank">
|
3
|
+
<picture>
|
4
|
+
<source srcset="https://sentry-brand.storage.googleapis.com/sentry-logo-white.png" media="(prefers-color-scheme: dark)" />
|
5
|
+
<source srcset="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" />
|
6
|
+
<img src="https://sentry-brand.storage.googleapis.com/sentry-logo-black.png" alt="Sentry" width="280">
|
7
|
+
</picture>
|
4
8
|
</a>
|
5
|
-
<br />
|
6
9
|
</p>
|
7
10
|
|
8
11
|
_Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, so we can get back to enjoying technology. If you want to join us [<kbd>**Check out our open positions**</kbd>](https://sentry.io/careers/)_
|
@@ -17,6 +20,7 @@ Sentry SDK for Ruby
|
|
17
20
|
| [![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
21
|
| [![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
22
|
| [![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/) |
|
23
|
+
| [![Gem Version](https://img.shields.io/gem/v/sentry-opentelemetry?label=sentry-opentelemetry)](https://rubygems.org/gems/sentry-opentelemetry) | [![Build Status](https://github.com/getsentry/sentry-ruby/workflows/sentry-opentelemetry%20Test/badge.svg)](https://github.com/getsentry/sentry-ruby/actions/workflows/sentry_opentelemetry_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-opentelemetry.svg)](https://rubygems.org/gems/sentry-opentelemetry/) |
|
20
24
|
|
21
25
|
|
22
26
|
|
@@ -48,17 +52,16 @@ gem "sentry-rails"
|
|
48
52
|
gem "sentry-sidekiq"
|
49
53
|
gem "sentry-delayed_job"
|
50
54
|
gem "sentry-resque"
|
55
|
+
gem "sentry-opentelemetry"
|
51
56
|
```
|
52
57
|
|
53
58
|
### Configuration
|
54
59
|
|
55
|
-
You
|
56
|
-
|
60
|
+
You need to use Sentry.init to initialize and configure your SDK:
|
57
61
|
```ruby
|
58
62
|
Sentry.init do |config|
|
59
63
|
config.dsn = "MY_DSN"
|
60
64
|
end
|
61
|
-
|
62
65
|
```
|
63
66
|
|
64
67
|
To learn more about available configuration options, please visit the [official documentation](https://docs.sentry.io/platforms/ruby/configuration/options/).
|
@@ -87,6 +90,7 @@ To learn more about sampling transactions, please visit the [official documentat
|
|
87
90
|
- [Sidekiq](https://docs.sentry.io/platforms/ruby/guides/sidekiq/)
|
88
91
|
- [DelayedJob](https://docs.sentry.io/platforms/ruby/guides/delayed_job/)
|
89
92
|
- [Resque](https://docs.sentry.io/platforms/ruby/guides/resque/)
|
93
|
+
- [OpenTemeletry](https://docs.sentry.io/platforms/ruby/performance/instrumentation/opentelemetry/)
|
90
94
|
|
91
95
|
### Enriching Events
|
92
96
|
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require "rake/clean"
|
2
|
+
CLOBBER.include "pkg"
|
3
|
+
|
4
|
+
require "bundler/gem_helper"
|
5
|
+
Bundler::GemHelper.install_tasks(name: "sentry-ruby")
|
6
|
+
|
7
|
+
require "rspec/core/rake_task"
|
8
|
+
|
9
|
+
RSpec::Core::RakeTask.new(:spec).tap do |task|
|
10
|
+
task.rspec_opts = "--order rand"
|
11
|
+
end
|
12
|
+
|
13
|
+
task :default => :spec
|
data/bin/console
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "sentry-ruby"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
# Sentry.init do |config|
|
14
|
+
# config.dsn = 'https://2fb45f003d054a7ea47feb45898f7649@o447951.ingest.sentry.io/5434472'
|
15
|
+
# end
|
16
|
+
|
17
|
+
require "irb"
|
18
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "concurrent/executor/thread_pool_executor"
|
4
|
+
require "concurrent/executor/immediate_executor"
|
5
|
+
require "concurrent/configuration"
|
6
|
+
|
7
|
+
module Sentry
|
8
|
+
class BackgroundWorker
|
9
|
+
include LoggingHelper
|
10
|
+
|
11
|
+
attr_reader :max_queue, :number_of_threads
|
12
|
+
# @deprecated Use Sentry.logger to retrieve the current logger instead.
|
13
|
+
attr_reader :logger
|
14
|
+
attr_accessor :shutdown_timeout
|
15
|
+
|
16
|
+
def initialize(configuration)
|
17
|
+
@max_queue = 30
|
18
|
+
@shutdown_timeout = 1
|
19
|
+
@number_of_threads = configuration.background_worker_threads
|
20
|
+
@logger = configuration.logger
|
21
|
+
@debug = configuration.debug
|
22
|
+
@shutdown_callback = nil
|
23
|
+
|
24
|
+
@executor =
|
25
|
+
if configuration.async
|
26
|
+
log_debug("config.async is set, BackgroundWorker is disabled")
|
27
|
+
Concurrent::ImmediateExecutor.new
|
28
|
+
elsif @number_of_threads == 0
|
29
|
+
log_debug("config.background_worker_threads is set to 0, all events will be sent synchronously")
|
30
|
+
Concurrent::ImmediateExecutor.new
|
31
|
+
else
|
32
|
+
log_debug("Initializing the background worker with #{@number_of_threads} threads")
|
33
|
+
|
34
|
+
executor = Concurrent::ThreadPoolExecutor.new(
|
35
|
+
min_threads: 0,
|
36
|
+
max_threads: @number_of_threads,
|
37
|
+
max_queue: @max_queue,
|
38
|
+
fallback_policy: :discard
|
39
|
+
)
|
40
|
+
|
41
|
+
@shutdown_callback = proc do
|
42
|
+
executor.shutdown
|
43
|
+
executor.wait_for_termination(@shutdown_timeout)
|
44
|
+
end
|
45
|
+
|
46
|
+
executor
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# if you want to monkey-patch this method, please override `_perform` instead
|
51
|
+
def perform(&block)
|
52
|
+
@executor.post do
|
53
|
+
begin
|
54
|
+
_perform(&block)
|
55
|
+
rescue Exception => e
|
56
|
+
log_error("exception happened in background worker", e, debug: @debug)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def shutdown
|
62
|
+
log_debug("Shutting down background worker")
|
63
|
+
@shutdown_callback&.call
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def _perform(&block)
|
69
|
+
block.call
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|