Commit 89f371f
Suppress the unnecessary “unsupported options notice” (#2349)
* Suppress the unnecessary “unsupported options notice”
In `Scope#update_from_options()`, the method strips key-value pairs from
the `options` according to its parameters. When all keys in `options` are
supported, it still logs an “unsupported options notice” for an empty
`unsupported_option_keys` value with empty array literal in
`Sentry::Hub#capture_event`, like:
"Options [] are not supported and will not be applied to the event."
Example:
When calling `subject.capture_event(event, level: 'DEBUG')`, the
`capture_event` method should handle the options like this:
# In this case, options == {:level=>'DEBUG'}
unsupported_option_keys = scope.update_from_options(**options)
# unsupported_option_keys should be [], but the following debug log will be shown
# like "Options [] are not supported and will not be applied to the event."
configuration.log_debug <<~MSG
Options #{unsupported_option_keys} are not supported and will not be applied to the event.
You may want to set them under the `extra` option.
MSG
This patch changes the logic to check whether `unsupported_option_keys` is
empty before logging the notice, thus suppressing unnecessary logs.
Signed-off-by: moznion <[email protected]>
* Update sentry-ruby/spec/sentry/hub_spec.rb
---------
Signed-off-by: moznion <[email protected]>
Co-authored-by: Stan Lo <[email protected]>1 parent 36866c5 commit 89f371f
File tree
3 files changed
+18
-4
lines changed- sentry-ruby
- lib/sentry
- spec/sentry
3 files changed
+18
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
202 | 204 | | |
203 | 205 | | |
204 | 206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
350 | 350 | | |
351 | 351 | | |
352 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
353 | 361 | | |
354 | 362 | | |
355 | 363 | | |
| |||
0 commit comments