Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress the unnecessary “unsupported options notice” #2349

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- Use Concurrent.usable_processor_count when it is available ([#2339](https://github.com/getsentry/sentry-ruby/pull/2339))

### Bug Fixes

- Suppress the unnecessary “unsupported options notice” ([#2349](https://github.com/getsentry/sentry-ruby/pull/2349))

## 5.18.1

### Bug Fixes
Expand Down
10 changes: 6 additions & 4 deletions sentry-ruby/lib/sentry/hub.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,12 @@
elsif !options.empty?
unsupported_option_keys = scope.update_from_options(**options)

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
unless unsupported_option_keys.empty?
configuration.log_debug <<~MSG

Check warning on line 199 in sentry-ruby/lib/sentry/hub.rb

View check run for this annotation

Codecov / codecov/patch

sentry-ruby/lib/sentry/hub.rb#L198-L199

Added lines #L198 - L199 were not covered by tests
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
end
end

event = current_client.capture_event(event, scope, hint)
Expand Down
8 changes: 8 additions & 0 deletions sentry-ruby/spec/sentry/hub_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,14 @@
expect(string_io.string).to include("Options [:unsupported] are not supported and will not be applied to the event.")
end

it "does not warn about unsupported options if all passed options are supported" do
expect do
subject.capture_event(event, level: 'DEBUG')
end.not_to raise_error

expect(string_io.string).not_to include("Options [] are not supported and will not be applied to the event.")
end

context "when event is a transaction" do
it "transaction.set_context merges and takes precedence over scope.set_context" do
scope.set_context(:foo, { val: 42 })
Expand Down
Loading