Suppress the unnecessary “unsupported options notice”#2349
Merged
st0012 merged 2 commits intogetsentry:masterfrom Jul 23, 2024
Merged
Conversation
4e60762 to
f71019f
Compare
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 <moznion@mail.moznion.net>
f71019f to
e549293
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2349 +/- ##
===========================================
- Coverage 98.66% 78.25% -20.41%
===========================================
Files 205 146 -59
Lines 13483 6889 -6594
===========================================
- Hits 13303 5391 -7912
- Misses 180 1498 +1318
|
st0012
reviewed
Jul 23, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A related change was introduced in #2303.
Description
In
Scope#update_from_options(), the method strips key-value pairs from theoptionsaccording to its parameters. When all keys inoptionsare supported, it still logs an “unsupported options notice” for an emptyunsupported_option_keysvalue with empty array literal inSentry::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'), thecapture_eventmethod should handle the options like this:This patch changes the logic to check whether
unsupported_option_keysis empty before logging the notice, thus suppressing unnecessary logs.