sentry-raven 2.9.0 → 3.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.craft.yml +19 -0
- data/.scripts/bump-version.rb +5 -0
- data/{changelog.md → CHANGELOG.md} +239 -2
- data/Gemfile +24 -25
- data/Makefile +3 -0
- data/README.md +46 -18
- data/lib/raven/backtrace.rb +9 -5
- data/lib/raven/base.rb +8 -3
- data/lib/raven/breadcrumbs.rb +1 -1
- data/lib/raven/breadcrumbs/{activesupport.rb → active_support_logger.rb} +9 -3
- data/lib/raven/breadcrumbs/logger.rb +2 -92
- data/lib/raven/breadcrumbs/sentry_logger.rb +73 -0
- data/lib/raven/cli.rb +10 -21
- data/lib/raven/client.rb +28 -10
- data/lib/raven/configuration.rb +103 -13
- data/lib/raven/context.rb +13 -8
- data/lib/raven/core_ext/object/deep_dup.rb +57 -0
- data/lib/raven/core_ext/object/duplicable.rb +153 -0
- data/lib/raven/event.rb +32 -22
- data/lib/raven/helpers/deprecation_helper.rb +17 -0
- data/lib/raven/instance.rb +29 -5
- data/lib/raven/integrations/delayed_job.rb +16 -16
- data/lib/raven/integrations/rack-timeout.rb +7 -4
- data/lib/raven/integrations/rack.rb +9 -7
- data/lib/raven/integrations/rails.rb +13 -3
- data/lib/raven/integrations/rails/active_job.rb +11 -7
- data/lib/raven/integrations/rails/backtrace_cleaner.rb +29 -0
- data/lib/raven/integrations/rails/controller_transaction.rb +1 -1
- data/lib/raven/integrations/rails/overrides/debug_exceptions_catcher.rb +2 -2
- data/lib/raven/integrations/sidekiq.rb +4 -78
- data/lib/raven/integrations/sidekiq/cleanup_middleware.rb +13 -0
- data/lib/raven/integrations/sidekiq/error_handler.rb +38 -0
- data/lib/raven/interface.rb +2 -2
- data/lib/raven/interfaces/stack_trace.rb +1 -1
- data/lib/raven/linecache.rb +5 -2
- data/lib/raven/logger.rb +3 -2
- data/lib/raven/processor/cookies.rb +16 -6
- data/lib/raven/processor/post_data.rb +2 -0
- data/lib/raven/processor/removecircularreferences.rb +3 -1
- data/lib/raven/processor/sanitizedata.rb +65 -17
- data/lib/raven/processor/utf8conversion.rb +3 -1
- data/lib/raven/transports.rb +4 -0
- data/lib/raven/transports/http.rb +7 -8
- data/lib/raven/utils/context_filter.rb +42 -0
- data/lib/raven/utils/exception_cause_chain.rb +1 -0
- data/lib/raven/utils/real_ip.rb +1 -1
- data/lib/raven/utils/request_id.rb +16 -0
- data/lib/raven/version.rb +2 -2
- data/lib/sentry-raven-without-integrations.rb +6 -1
- data/lib/sentry_raven_without_integrations.rb +1 -0
- data/sentry-raven.gemspec +10 -3
- metadata +25 -20
- data/.gitignore +0 -13
- data/.gitmodules +0 -0
- data/.rspec +0 -1
- data/.rubocop.yml +0 -74
- data/.travis.yml +0 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8c836de333d5f6013b562a5d189b6e775ca61965c7070a111b61d37402d318d1
|
4
|
+
data.tar.gz: b1923aeea7733a7e0d51fdc6e2f49b7dd046b5eaaba1067507229d0cc5262352
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ae04b49b38a134386b44e04675f47bbf9742ba1b39f84ac0c51a87b3852380c1b60d91a7a7c67e208a9415c75880559941ac343cb3378a8129259b4aeb63984
|
7
|
+
data.tar.gz: 0fd029cf50d3a54f98906cee4f1c4177282f91030239f093d53e3949bc37a533fd4557f6f932e5c22051416e92ff28a53da7fbc2a9086c83181538f8c81d6c83
|
data/.craft.yml
ADDED
@@ -0,0 +1,19 @@
|
|
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-raven
|
8
|
+
statusProvider:
|
9
|
+
name: github
|
10
|
+
artifactProvider:
|
11
|
+
name: github
|
12
|
+
targets:
|
13
|
+
- name: gem
|
14
|
+
- name: github
|
15
|
+
tagPrefix: sentry-raven-v
|
16
|
+
- name: registry
|
17
|
+
type: sdk
|
18
|
+
config:
|
19
|
+
canonical: 'gem:sentry-raven'
|
@@ -1,3 +1,240 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 3.1.2
|
4
|
+
|
5
|
+
- Fix Delayed::Plugins::Raven when job raises exception [#1057](https://github.com/getsentry/sentry-ruby/pull/1057)
|
6
|
+
- Merge hash instead of replacing the original value in user_context [#1064](https://github.com/getsentry/sentry-ruby/pull/1064)
|
7
|
+
- Don't exclude ActionView::MissingTemplate error by default [#1092](https://github.com/getsentry/sentry-ruby/pull/1092)
|
8
|
+
- Fix typo: much -> must for Raven::Event [#1106](https://github.com/getsentry/sentry-ruby/pull/1106)
|
9
|
+
- Fix undefined local variable or method logger [#1143](https://github.com/getsentry/sentry-ruby/pull/1143)
|
10
|
+
- Fixes [#1110](https://github.com/getsentry/sentry-ruby/issues/1110)
|
11
|
+
- fix format headers for sentry-raven [#1198](https://github.com/getsentry/sentry-ruby/pull/1198)
|
12
|
+
- Print deprecation message after sentry-raven is installed [#1206](https://github.com/getsentry/sentry-ruby/pull/1206)
|
13
|
+
|
14
|
+
## 3.1.1
|
15
|
+
|
16
|
+
**Feature**
|
17
|
+
|
18
|
+
- Add request id to headers if exists ([#1033](https://github.com/getsentry/sentry-ruby/pull/1033))
|
19
|
+
|
20
|
+
- Allow blocks on user_context ([#1023](https://github.com/getsentry/sentry-ruby/pull/1023))
|
21
|
+
|
22
|
+
- Enable configurable rack environment recorded parameters ([#860](https://github.com/getsentry/sentry-ruby/pull/860))
|
23
|
+
|
24
|
+
- Remove ActiveJob keys for both Sidekiq and DelayedJob ([#898](https://github.com/getsentry/sentry-ruby/pull/898))
|
25
|
+
|
26
|
+
**Fix**
|
27
|
+
|
28
|
+
- Remove circular dependency in transport/http.rb ([#1035](https://github.com/getsentry/sentry-ruby/pull/1035))
|
29
|
+
|
30
|
+
## 3.1.0
|
31
|
+
|
32
|
+
**Feature**
|
33
|
+
|
34
|
+
- Exclude all 4xx Rails errors ([#1004](https://github.com/getsentry/raven-ruby/pull/1004))
|
35
|
+
|
36
|
+
See the full list [here](https://github.com/getsentry/raven-ruby/blob/master/lib/raven/configuration.rb#L198-L219)
|
37
|
+
|
38
|
+
- Add some error context in `transport_failure_callback` ([#1003](https://github.com/getsentry/raven-ruby/pull/1003))
|
39
|
+
|
40
|
+
Before:
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
config.transport_failure_callback = lambda { |event|
|
44
|
+
AdminMailer.email_admins("Oh god, it's on fire!", event).deliver_later
|
45
|
+
}
|
46
|
+
```
|
47
|
+
|
48
|
+
After:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
config.transport_failure_callback = lambda { |event, error|
|
52
|
+
AdminMailer.email_admins("Oh god, it's on fire because #{error.message}!", event).deliver_later
|
53
|
+
}
|
54
|
+
```
|
55
|
+
|
56
|
+
- Support cleaning up exception backtrace with customized backtrace_cleaner ([#1011](https://github.com/getsentry/raven-ruby/pull/1011))
|
57
|
+
|
58
|
+
The new config `backtrace_cleanup_callback` takes a lambda/proc object (default is `nil`) and will be called with exception's backtrace
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
Raven.configure do |config|
|
62
|
+
config.backtrace_cleanup_callback = lambda do |backtrace|
|
63
|
+
Rails.backtrace_cleaner.clean(backtrace)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
```
|
67
|
+
|
68
|
+
And with the Rails integration, it'll automatically use a customized `Raven::Rails::BacktraceCleaner` to clean up exception's backtrace. It's basically Rails 6's [backtrace cleaner](https://github.com/rails/rails/blob/master/railties/lib/rails/backtrace_cleaner.rb) but without silencers.
|
69
|
+
|
70
|
+
The main reason to add this cleaner is to remove template methods from the trace, e.g.
|
71
|
+
|
72
|
+
```
|
73
|
+
app/views/welcome/view_error.html.erb in _app_views_welcome_view_error_html_erb__2807287320172182514_65600 at line 1
|
74
|
+
```
|
75
|
+
|
76
|
+
will become
|
77
|
+
|
78
|
+
```
|
79
|
+
app/views/welcome/view_error.html.erb at line 1
|
80
|
+
```
|
81
|
+
|
82
|
+
This can help Sentry group issues more accurately. See [#957](https://github.com/getsentry/raven-ruby/issues/957) for more information about this.
|
83
|
+
|
84
|
+
If you don't want this change, you can disable it with:
|
85
|
+
|
86
|
+
```ruby
|
87
|
+
Raven.configure do |config|
|
88
|
+
config.backtrace_cleanup_callback = nil
|
89
|
+
end
|
90
|
+
```
|
91
|
+
|
92
|
+
|
93
|
+
- Make dsn value accessable from config ([#1012](https://github.com/getsentry/raven-ruby/pull/1012))
|
94
|
+
|
95
|
+
You can now access the dsn value via `Raven.configuration.dsn`
|
96
|
+
|
97
|
+
**Deprecation**
|
98
|
+
|
99
|
+
- Deprecate dasherized filenames ([#1006](https://github.com/getsentry/raven-ruby/pull/1006))
|
100
|
+
|
101
|
+
If you're using
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
gem 'sentry-raven', require: 'sentry-raven-without-integrations'
|
105
|
+
# or
|
106
|
+
require "sentry-raven-without-integrations"
|
107
|
+
```
|
108
|
+
|
109
|
+
you will start seeing deprecation warnings. Please change them into
|
110
|
+
|
111
|
+
```ruby
|
112
|
+
gem 'sentry-raven', require: 'sentry_raven_without_integrations'
|
113
|
+
# or
|
114
|
+
require "sentry_raven_without_integrations"
|
115
|
+
```
|
116
|
+
|
117
|
+
- Unify breadcrumb loggers activation ([#1016](https://github.com/getsentry/raven-ruby/pull/1016))
|
118
|
+
|
119
|
+
Currently, we activate our breadcrumb loggers differently:
|
120
|
+
|
121
|
+
```ruby
|
122
|
+
require "raven/breadcrumbs/sentry_logger"
|
123
|
+
Raven.configuration.rails_activesupport_breadcrumbs = true
|
124
|
+
```
|
125
|
+
|
126
|
+
It's not a nice user interface, so this PR adds a new configuration
|
127
|
+
option `breadcrumbs_logger` to improve this:
|
128
|
+
|
129
|
+
```ruby
|
130
|
+
Raven.configuration.breadcrumbs_logger = :sentry_logger
|
131
|
+
Raven.configuration.breadcrumbs_logger = :active_support_logger
|
132
|
+
Raven.configuration.breadcrumbs_logger = [:sentry_logger, :active_support_logger]
|
133
|
+
```
|
134
|
+
|
135
|
+
Please migrate to the new activation apporach, otherwise you'll see depraction warnings. And old ones will be dropped in version 4.0.
|
136
|
+
|
137
|
+
**Refactor**
|
138
|
+
|
139
|
+
- Accept non-string message in Event.from_exception ([#1005](https://github.com/getsentry/raven-ruby/pull/1005))
|
140
|
+
- Refactor event initialization ([#1010](https://github.com/getsentry/raven-ruby/pull/1010))
|
141
|
+
- Refactor sidekiq integration ([#1019](https://github.com/getsentry/raven-ruby/pull/1019))
|
142
|
+
|
143
|
+
**Fix**
|
144
|
+
|
145
|
+
- Replace sys_command usages in context.rb ([#1017](https://github.com/getsentry/raven-ruby/pull/1017))
|
146
|
+
- Fix merge error from rack-timeout raven_context on old releases ([#1007](https://github.com/getsentry/raven-ruby/pull/1007))
|
147
|
+
- Return value of `rescue_with_handler` when intercepting ActiveJob exceptions ([#1027](https://github.com/getsentry/raven-ruby/pull/1027))
|
148
|
+
|
149
|
+
## 3.0.4
|
150
|
+
|
151
|
+
- fix: Don't log warning messages when it doesn't need to (#1000)
|
152
|
+
- fix: Revert "Refactor Raven::Client class" (#1002)
|
153
|
+
|
154
|
+
## 3.0.3
|
155
|
+
|
156
|
+
- fix: Ensure Processor::Cookie can run after Processor::RemoveCircularReferences (#996)
|
157
|
+
- fix: Avoid mutating user passed in options (#994)
|
158
|
+
- fix: Fix/Refactor Raven::Cli (#989)
|
159
|
+
- ref: Refactor Raven::Client class (#995)
|
160
|
+
- It adds `Event#message_from_exception` and `Event#log_message` interfaces
|
161
|
+
|
162
|
+
## 3.0.2
|
163
|
+
|
164
|
+
- fix: Add gem target for craft
|
165
|
+
|
166
|
+
## 3.0.1
|
167
|
+
|
168
|
+
- fix: Improve SanitizeData processor (#984)
|
169
|
+
- fix: Masking cookies as key/pair instead of a single string (#983)
|
170
|
+
- fix: Transports classes' requiring issue (#986)
|
171
|
+
- fix: Frozen string issues (#977)
|
172
|
+
- feat: Officially support Rails 6 (#982)
|
173
|
+
|
174
|
+
3.0.0
|
175
|
+
----
|
176
|
+
|
177
|
+
* SDK now requires Ruby >= 2.3
|
178
|
+
* REF: Retain any literal "HTTP-" in header names [@elliterate, #950]
|
179
|
+
* REF: Delete JSON spec for recursive hashes [@ksylvest, #952]
|
180
|
+
* FEAT: Bump faraday version to latest [@ksylvest, #946]
|
181
|
+
|
182
|
+
2.13.0
|
183
|
+
----
|
184
|
+
|
185
|
+
* FIX: Sanitize event data before they are sent to async job. [@edariedl, #895]
|
186
|
+
* FIX: Serialization MongoDB ObjectId to JSON problem with gem delayed_job_mongoid conjunction. [@eagleas, #935]
|
187
|
+
* FEAT: Skip ActiveJob integration if there is a better one [@fsateler, #909]
|
188
|
+
* FIX: Bugs with send_event in asynchronous mode (#940) [@cstyles, #940]
|
189
|
+
|
190
|
+
2.12.3
|
191
|
+
----
|
192
|
+
|
193
|
+
* FIX: crash when Process.wait is used [@asBrettisay, #895]
|
194
|
+
|
195
|
+
2.12.2
|
196
|
+
----
|
197
|
+
|
198
|
+
* FIX: return tags/extra for [@rivayama, #931]
|
199
|
+
|
200
|
+
2.12.1
|
201
|
+
----
|
202
|
+
|
203
|
+
* FIX: undefined method `[]' for nil:NilClass [@HazAT, #932]
|
204
|
+
|
205
|
+
2.12.0
|
206
|
+
----
|
207
|
+
|
208
|
+
* FIX: Remove duplicate message when exception is emitted
|
209
|
+
* FIX: Frozen string bug in utf8conversation
|
210
|
+
* FEATURE: Allow block on tags_context and extra_context
|
211
|
+
|
212
|
+
2.11.3
|
213
|
+
----
|
214
|
+
|
215
|
+
* FIX: infinite backoff under pressure [@Bonias, #886]
|
216
|
+
|
217
|
+
2.11.2
|
218
|
+
----
|
219
|
+
|
220
|
+
* REF: Warn on 4xx error [@iloveitaly, #862]
|
221
|
+
|
222
|
+
2.11.1
|
223
|
+
----
|
224
|
+
|
225
|
+
* FIX: Call `to_s` on breadcrumb message [@halkeye, #914]
|
226
|
+
|
227
|
+
2.11.0
|
228
|
+
----
|
229
|
+
|
230
|
+
* FEATURE: Prepend the transaction around_action so libraries with controllers can alter the value. [@drcapulet, #887]
|
231
|
+
|
232
|
+
2.10.0
|
233
|
+
-----
|
234
|
+
|
235
|
+
* FEATURE: Added support for `SENTRY_ENVIRONMENT` [@mtsmfm, #910]
|
236
|
+
* FEATURE: Added support for `SENTRY_RELEASE` [@coorasse, #911]
|
237
|
+
|
1
238
|
2.9.0
|
2
239
|
-----
|
3
240
|
|
@@ -7,7 +244,7 @@
|
|
7
244
|
2.8.0
|
8
245
|
-----
|
9
246
|
|
10
|
-
* FEATURE: Added `config.before_send`. Provide a lambda or proc to this config setting, which will be `call`ed
|
247
|
+
* FEATURE: Added `config.before_send`. Provide a lambda or proc to this config setting, which will be `call`ed before sending an event to Sentry. Receives `event` and `hint` as parameters. `hint` is a hash `{:exception => ex | nil, :message => message | nil}`. [@hazat, #882]
|
11
248
|
|
12
249
|
2.7.4
|
13
250
|
-----
|
@@ -419,7 +656,7 @@ OTHER CHANGES:
|
|
419
656
|
0.12.0
|
420
657
|
------
|
421
658
|
|
422
|
-
- You can now give additional fields to the SanitizeData processor. Values matched are replaced by the string mask (*********). Full documentation (and how to use with Rails config.filter_parameters) [here](https://docs.
|
659
|
+
- You can now give additional fields to the SanitizeData processor. Values matched are replaced by the string mask (*********). Full documentation (and how to use with Rails config.filter_parameters) [here](https://docs.sentry.io/platforms/ruby/config/). [jamescway, #232]
|
423
660
|
- An additional processor has been added, though it isn't turned on by default: RemoveStacktrace. Use it to remove stacktraces from exception reports. [nateberkopec, #233]
|
424
661
|
- Dependency on `uuidtools` has been removed. [nateberkopec, #231]
|
425
662
|
|
data/Gemfile
CHANGED
@@ -2,37 +2,36 @@ source "https://rubygems.org/"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
gem "rspec-rails", "> 3"
|
8
|
-
elsif ENV["RAILS_VERSION"] && (ENV["RAILS_VERSION"].to_i == 0)
|
9
|
-
# no-op. No Rails.
|
10
|
-
else
|
11
|
-
gem "rails", "< 6"
|
12
|
-
gem "rspec-rails", "> 3"
|
13
|
-
end
|
5
|
+
rails_version = ENV["RAILS_VERSION"]
|
6
|
+
rails_version = "5.2" if rails_version.nil?
|
14
7
|
|
15
|
-
if
|
16
|
-
gem "
|
17
|
-
gem "
|
18
|
-
gem "rack", "~> 1.6.8"
|
19
|
-
gem "sidekiq", "< 3.2"
|
20
|
-
gem "rack-timeout", "0.3.0"
|
21
|
-
else
|
22
|
-
gem "rack"
|
23
|
-
gem "sidekiq"
|
24
|
-
gem "rack-timeout"
|
8
|
+
if rails_version.to_f != 0
|
9
|
+
gem "rails", "~> #{rails_version}"
|
10
|
+
gem "rspec-rails", "~> 4.0"
|
25
11
|
end
|
12
|
+
|
13
|
+
gem "delayed_job"
|
14
|
+
gem "sidekiq"
|
15
|
+
|
16
|
+
gem "rack"
|
17
|
+
gem "rack-timeout"
|
18
|
+
|
19
|
+
# TODO: Remove this if https://github.com/jruby/jruby/issues/6547 is addressed
|
20
|
+
gem "i18n", "<= 1.8.7"
|
21
|
+
|
26
22
|
gem "pry"
|
27
|
-
gem "pry-coolline"
|
28
23
|
gem "benchmark-ips"
|
29
|
-
gem "
|
24
|
+
gem "benchmark_driver"
|
25
|
+
gem "benchmark-ipsa"
|
26
|
+
gem "benchmark-memory"
|
30
27
|
gem "ruby-prof", platform: :mri
|
31
28
|
gem "rake", "> 12"
|
32
|
-
gem "rubocop", "~> 0.
|
33
|
-
gem "rspec", "
|
34
|
-
gem "capybara" # rspec system tests
|
29
|
+
gem "rubocop", "~> 0.81.0"
|
30
|
+
gem "rspec", "~> 3.9.0"
|
31
|
+
gem "capybara", "~> 3.15.0" # rspec system tests
|
35
32
|
gem "puma" # rspec system tests
|
36
33
|
|
37
34
|
gem "timecop"
|
38
|
-
gem "test-unit"
|
35
|
+
gem "test-unit"
|
36
|
+
gem "simplecov"
|
37
|
+
gem "codecov", "<= 0.2.12"
|
data/Makefile
ADDED
data/README.md
CHANGED
@@ -7,19 +7,38 @@
|
|
7
7
|
|
8
8
|
# Raven-Ruby, the Ruby Client for Sentry
|
9
9
|
|
10
|
+
### 🚧 Migrating To The New SDK 🚧
|
11
|
+
|
12
|
+
We've released our new Ruby SDK, [sentry-ruby](https://github.com/getsentry/sentry-ruby/tree/master/sentry-ruby). Here are the benefits of migrating to it:
|
13
|
+
|
14
|
+
- **Unified Interfaces With Other SDKs:** The design of `sentry-raven` is outdated compared with our modern Sentry SDKs. If you also use other Sentry SDKs, such as Sentry's JavaScript SDK for your frontend application, you'll notice that their interfaces are quite different from the one provided for `sentry-raven`. The new `sentry-ruby` SDK provides a more consistent user experience across all different platforms.
|
15
|
+
|
16
|
+
- **Performance Monitoring:** The Sentry Ruby SDK includes [performance monitoring](https://docs.sentry.io/product/performance/), which you can enable if you haven't already as ([discussed here](https://docs.sentry.io/platforms/ruby/performance/)).
|
17
|
+
|
18
|
+
- **Future Support:** `sentry-raven` has entered maintenance mode, which means it won't receive any new feature supports or aggressive bug fixes.
|
19
|
+
|
20
|
+
- **Better Extensibility:** Unlike `sentry-raven`, `sentry-ruby` is built with extensibility in mind and will allow the community to build extensions for different integrations/features.
|
21
|
+
|
22
|
+
If you're interested in the migration, please also read our [migration guide](https://docs.sentry.io/platforms/ruby/migration/) for more information.
|
23
|
+
|
24
|
+
---
|
25
|
+
|
26
|
+
|
10
27
|
[![Gem Version](https://img.shields.io/gem/v/sentry-raven.svg)](https://rubygems.org/gems/sentry-raven)
|
11
|
-
|
28
|
+
![Build Status](https://github.com/getsentry/raven-ruby/workflows/Test/badge.svg)
|
29
|
+
[![Coverage Status](https://img.shields.io/codecov/c/github/getsentry/sentry-ruby/master?logo=codecov)](https://codecov.io/gh/getsentry/sentry-ruby/branch/master)
|
12
30
|
[![Gem](https://img.shields.io/gem/dt/sentry-raven.svg)](https://rubygems.org/gems/sentry-raven/)
|
13
31
|
[![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=sentry-raven&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=sentry-raven&package-manager=bundler&version-scheme=semver)
|
14
32
|
|
15
33
|
|
16
|
-
[Documentation](https://docs.
|
34
|
+
[Documentation](https://docs.sentry.io/clients/ruby/) | [Bug Tracker](https://github.com/getsentry/raven-ruby/issues) | [Forum](https://forum.sentry.io/) | IRC: irc.freenode.net, #sentry
|
17
35
|
|
18
36
|
The official Ruby-language client and integration layer for the [Sentry](https://github.com/getsentry/sentry) error reporting API.
|
19
37
|
|
38
|
+
|
20
39
|
## Requirements
|
21
40
|
|
22
|
-
We test on Ruby
|
41
|
+
We test on Ruby 2.3, 2.4, 2.5, 2.6 and 2.7 at the latest patchlevel/teeny version. We also support JRuby 9.0. Our Rails integration works with Rails 4.2+, including Rails 5 and Rails 6.
|
23
42
|
|
24
43
|
## Getting Started
|
25
44
|
|
@@ -29,7 +48,7 @@ We test on Ruby 1.9, 2.2, 2.3, and 2.4 at the latest patchlevel/teeny version. W
|
|
29
48
|
gem "sentry-raven"
|
30
49
|
```
|
31
50
|
|
32
|
-
### Raven only runs when
|
51
|
+
### Raven only runs when Sentry DSN is set
|
33
52
|
|
34
53
|
Raven 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!
|
35
54
|
|
@@ -38,7 +57,7 @@ Raven will capture and send exceptions to the Sentry server whenever its DSN is
|
|
38
57
|
export SENTRY_DSN=http://public@example.com/project-id
|
39
58
|
```
|
40
59
|
```ruby
|
41
|
-
# Or you can configure the client in the code
|
60
|
+
# Or you can configure the client in the code.
|
42
61
|
Raven.configure do |config|
|
43
62
|
config.dsn = 'http://public@example.com/project-id'
|
44
63
|
end
|
@@ -48,11 +67,11 @@ end
|
|
48
67
|
|
49
68
|
**Raven ignores some exceptions by default** - most of these are related to 404s or controller actions not being found. [For a complete list, see the `IGNORE_DEFAULT` constant](https://github.com/getsentry/raven-ruby/blob/master/lib/raven/configuration.rb).
|
50
69
|
|
51
|
-
Raven doesn't report POST data or cookies by default. In addition, it will attempt to remove any obviously sensitive data, such as credit card or Social Security numbers. For more information about how Sentry processes your data, [check out the documentation on the `processors` config setting.](https://docs.
|
70
|
+
Raven doesn't report POST data or cookies by default. In addition, it will attempt to remove any obviously sensitive data, such as credit card or Social Security numbers. For more information about how Sentry processes your data, [check out the documentation on the `processors` config setting.](https://docs.sentry.io/platforms/ruby/configuration/options/)
|
52
71
|
|
53
72
|
### Usage
|
54
73
|
|
55
|
-
**If you use Rails, you're already done - no more configuration required!** Check [Integrations](https://docs.
|
74
|
+
**If you use Rails, you're already done - no more configuration required!** Check [Integrations](https://docs.sentry.io/platforms/ruby/configuration/integrations/) for more details on other gems Sentry integrates with automatically.
|
56
75
|
|
57
76
|
Otherwise, Raven supports two methods of capturing exceptions:
|
58
77
|
|
@@ -104,33 +123,42 @@ end
|
|
104
123
|
If Raven fails to send an event to Sentry for any reason (either the Sentry server has returned a 4XX or 5XX response), this Proc or lambda will be called.
|
105
124
|
|
106
125
|
```ruby
|
107
|
-
config.transport_failure_callback = lambda { |event|
|
108
|
-
AdminMailer.email_admins("Oh god, it's on fire!", event).deliver_later
|
126
|
+
config.transport_failure_callback = lambda { |event, error|
|
127
|
+
AdminMailer.email_admins("Oh god, it's on fire because #{error.message}!", event).deliver_later
|
109
128
|
}
|
110
129
|
```
|
111
130
|
|
112
131
|
#### Context
|
113
132
|
|
114
|
-
Much of the usefulness of Sentry comes from additional context data with the events. Raven makes this very convenient by providing methods to set thread local context data that is then submitted automatically with all events
|
115
|
-
|
116
|
-
There are three primary methods for providing request context:
|
133
|
+
Much of the usefulness of Sentry comes from additional context data with the events. Raven makes this very convenient by providing methods to set thread local context data that is then submitted automatically with all events:
|
117
134
|
|
118
135
|
```ruby
|
119
|
-
# bind the logged in user
|
120
136
|
Raven.user_context email: 'foo@example.com'
|
121
137
|
|
122
|
-
# tag the request with something interesting
|
123
138
|
Raven.tags_context interesting: 'yes'
|
124
139
|
|
125
|
-
|
126
|
-
|
140
|
+
Raven.extra_context additional_info: 'foo'
|
141
|
+
```
|
142
|
+
|
143
|
+
You can also use `tags_context` and `extra_context` to provide scoped information:
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
Raven.tags_context(interesting: 'yes') do
|
147
|
+
# the `interesting: 'yes'` tag will only present in the requests sent inside the block
|
148
|
+
Raven.capture_exception(exception)
|
149
|
+
end
|
150
|
+
|
151
|
+
Raven.extra_context(additional_info: 'foo') do
|
152
|
+
# same as above, the `additional_info` will only present in this request
|
153
|
+
Raven.capture_exception(exception)
|
154
|
+
end
|
127
155
|
```
|
128
156
|
|
129
|
-
For more information, see [Context](https://docs.sentry.io/
|
157
|
+
For more information, see [Context](https://docs.sentry.io/platforms/ruby/enriching-events/context/).
|
130
158
|
|
131
159
|
## More Information
|
132
160
|
|
133
161
|
* [Documentation](https://docs.sentry.io/clients/ruby/)
|
134
162
|
* [Bug Tracker](https://github.com/getsentry/raven-ruby/issues)
|
135
163
|
* [Forum](https://forum.sentry.io/)
|
136
|
-
|
164
|
+
- [Discord](https://discord.gg/ez5KZN7)
|