GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Migrate from to_hash to to_h by st0012 · Pull Request #2351 · getsentry/sentry-ruby

Conversation

@st0012

@st0012 st0012 commented Jul 23, 2024

Copy link
Copy Markdown
Contributor

As @solnic pointed out in #2350 (comment) to_hash has special meaning in Ruby and could be called implicitly in contexts like double splatting argument. So we should switch to to_h to avoid potential issues.

Additionally, Matz also explained that in the explicit conversion usages (which is the case for the SDK), to_h should be used.

Compatibility Concern

Since this PR changes the serialization interface of almost all SDK's internal components, if users/libs relied on patching to_hash to extend/modify the data, this could become a breaking change for them. And because to_hash has been that interface since the old sentry-raven SDK (for at least 12 years), I think we can assume at least some legacy apps had built customization on top of it.

For this reason, maybe this should be shipped in 6.0?

(In cases where Configuration#async is set, we use Event#to_json_compatible instead, so they won't be affected)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sl0thentr0py reacted with thumbs up emoji solnic reacted with heart emoji
All reactions
  • 👍 1 reaction
  • ❤️ 1 reaction
@st0012
st0012 requested review from sl0thentr0py and solnic July 23, 2024 10:54
@st0012 st0012 mentioned this pull request Jul 23, 2024
Don't overwrite ip_address if already set on user #2350
Merged
@codecov

codecov Bot commented Jul 23, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.63%. Comparing base (7db04c9) to head (0b74d98).

Additional details and impacted files
@@           Coverage Diff            @@
##           6.0-dev    #2351   +/-   ##
========================================
  Coverage    98.63%   98.63%           
========================================
  Files          204      204           
  Lines        13286    13286           
========================================
+ Hits         13104    13105    +1     
+ Misses         182      181    -1     
Components Coverage Δ
sentry-ruby 99.01% <100.00%> (+0.01%) ⬆️
sentry-rails 97.30% <100.00%> (ø)
sentry-sidekiq 97.01% <100.00%> (ø)
sentry-resque 96.79% <100.00%> (ø)
sentry-delayed_job 98.92% <100.00%> (ø)
sentry-opentelemetry 100.00% <ø> (ø)
Files Coverage Δ
sentry-delayed_job/spec/sentry/delayed_job_spec.rb 100.00% <100.00%> (ø)
sentry-rails/spec/sentry/rails/activejob_spec.rb 99.42% <100.00%> (ø)
...ry/rails/breadcrumbs/active_support_logger_spec.rb 100.00% <100.00%> (ø)
...readcrumbs/monotonic_active_support_logger_spec.rb 91.54% <100.00%> (ø)
...rails/spec/sentry/rails/controller_methods_spec.rb 100.00% <100.00%> (ø)
sentry-rails/spec/sentry/rails/event_spec.rb 100.00% <100.00%> (ø)
...rails/tracing/action_controller_subscriber_spec.rb 100.00% <100.00%> (ø)
...entry/rails/tracing/action_view_subscriber_spec.rb 100.00% <100.00%> (ø)
...try/rails/tracing/active_record_subscriber_spec.rb 100.00% <100.00%> (ø)
...ry/rails/tracing/active_storage_subscriber_spec.rb 93.02% <100.00%> (ø)
... and 42 more

... and 1 file with indirect coverage changes

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sl0thentr0py

sl0thentr0py commented Jul 23, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

@st0012 thx! agree that this should be shipped in the next major.

I created a 6.0-dev branch
#2352

can you base this rebase this branch on that branch and change the base there?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@solnic

solnic commented Jul 24, 2024

Copy link
Copy Markdown
Collaborator

Thanks for tackling this! I did not expect you'd address it so quickly ❤️ This is definitely a potentially breaking change, but luckily it's easily fixable in people's codebases.

st0012 reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@st0012
Migrate from to_hash to to_h
a559f0d
As @solnic pointed out in #2350 (comment)
`to_hash` has special meaning in Ruby and could be called implicitly
in contexts like double splatting argument. So we should switch to `to_h`
to avoid potential issues.
@st0012
st0012 force-pushed the replace-to-hash branch from 0f2b2e9 to a559f0d Compare July 28, 2024 21:26
@st0012
st0012 changed the base branch from master to 6.0-dev July 28, 2024 21:26
@st0012
Update changelog
0b74d98
@st0012
st0012 marked this pull request as ready for review July 28, 2024 21:27
@st0012

st0012 commented Jul 28, 2024

Copy link
Copy Markdown
Contributor Author

@sl0thentr0py rebased 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

sl0thentr0py
sl0thentr0py approved these changes Jul 29, 2024
View reviewed changes
@sl0thentr0py
sl0thentr0py merged commit 329cccb into 6.0-dev Jul 29, 2024
@sl0thentr0py
sl0thentr0py deleted the replace-to-hash branch July 29, 2024 12:33
sl0thentr0py pushed a commit that referenced this pull request Oct 31, 2024
@st0012 @sl0thentr0py
Migrate from to_hash to to_h (#2351)
d7522f9
* Migrate from to_hash to to_h

As @solnic pointed out in #2350 (comment)
`to_hash` has special meaning in Ruby and could be called implicitly
in contexts like double splatting argument. So we should switch to `to_h`
to avoid potential issues.
@sl0thentr0py sl0thentr0py mentioned this pull request Oct 31, 2024
6.0 major #2352
Merged
sl0thentr0py pushed a commit that referenced this pull request Sep 17, 2025
@st0012 @sl0thentr0py
Migrate from to_hash to to_h (#2351)
a8bf8ac
* Migrate from to_hash to to_h

As @solnic pointed out in #2350 (comment)
`to_hash` has special meaning in Ruby and could be called implicitly
in contexts like double splatting argument. So we should switch to `to_h`
to avoid potential issues.
sl0thentr0py pushed a commit that referenced this pull request Sep 23, 2025
@st0012 @sl0thentr0py
Migrate from to_hash to to_h (#2351)
12a7ff1
* Migrate from to_hash to to_h

As @solnic pointed out in #2350 (comment)
`to_hash` has special meaning in Ruby and could be called implicitly
in contexts like double splatting argument. So we should switch to `to_h`
to avoid potential issues.
sl0thentr0py pushed a commit that referenced this pull request Sep 23, 2025
@st0012 @sl0thentr0py
Migrate from to_hash to to_h (#2351)
710a2f9
* Migrate from to_hash to to_h

As @solnic pointed out in #2350 (comment)
`to_hash` has special meaning in Ruby and could be called implicitly
in contexts like double splatting argument. So we should switch to `to_h`
to avoid potential issues.
sl0thentr0py added a commit that referenced this pull request Oct 22, 2025
@sl0thentr0py @st0012
6.0 major (#2352)
a1bd7e2
* Drop `async` configuration (#1894)

* Migrate from to_hash to to_h (#2351)

* Migrate from to_hash to to_h

As @solnic pointed out in #2350 (comment)
`to_hash` has special meaning in Ruby and could be called implicitly
in contexts like double splatting argument. So we should switch to `to_h`
to avoid potential issues.

* Fix specs after rebase

* Add before_send_check_in (#2703)

* Cleanup before_send to only apply to ErrorEvent
* remove the Hash deprecation message

* Archive sentry-raven (#2708)

Moved to https://github.com/getsentry/raven-ruby

* Remove stacktrace trimming from the SDK (#2714)

* Default config.enabled_environments to nil instead of [] (#2716)

* Remove :monotonic_active_support_logger (#2717)

* Add `config.trace_ignore_status_codes` to control which status codes don't get traced (#2725)

* Add config.trace_ignore_status_codes to control which status codes don't
get traced

* Change implementation to Range

* Don't send  client reports for profiles if profiling is disabled (#2728)

* Remove  and  and all metrics related code (#2729)

* Remove deprecated `config.capture_exception_frame_locals` (#2730)

* Remove deprecated capture_exception_frame_locals

* Remove deprecated config.enable_tracing (#2731)

* Remove deprecated config.enable_tracing

* Remove deprecated `config.logger` (#2732)

* Remove deprecated config.logger

* Remove deprecated Sentry::Rails::Tracing::ActionControllerSubscriber (#2733)

* Remove Transaction deprecations (#2736)

* Remove deprecated Event#configuration (#2740)

* Remove deprecated client methods (#2741)

* Bump required_ruby_version to 2.7 (#2743)

* Bump minimum rails version in `sentry-rails` to `5.2.0`
* Bump minimum sidekiq version in `sentry-sidekiq` to `5.0`
* Cleanup CI

* Remove hub from Transaction#initialize (#2739)

* Move examples out of SDK (#2746)

available at https://github.com/getsentry/examples/tree/master/ruby

* Add new config.profiles_sample_interval (#2745)

* Always set up the StructuredLogger and no-op capture_log_event if logs (#2752)

are disabled

* Make request body reading safe to rewind (#2754)

* Bump oversized stacktrace trunction to 500 on both sides

Revert "Remove stacktrace trimming from the SDK (#2714)"

This reverts commit ed7a2db.

---------

Co-authored-by: Stan Lo <[email protected]>
@scruti scruti mentioned this pull request Nov 4, 2025
Fix Sentry v6 interface DFE-Digital/teaching-vacancies#8248
Merged
10 tasks
Hassanmir92 added a commit to DFE-Digital/apply-for-qualified-teacher-status that referenced this pull request Feb 20, 2026
@Hassanmir92
Fixing issue with Sentry errors not being sent as Sentry::ErrorEvent …
ac43bd0
…no longer has a method to_hash. This has been changed to to_h

More information on this change can be found here: getsentry/sentry-ruby#2351
@Hassanmir92 Hassanmir92 mentioned this pull request Feb 20, 2026
Bump sentry-rails from 5.26.0 to 6.3.1 DFE-Digital/apply-for-qualified-teacher-status#3073
Merged
Hassanmir92 added a commit to DFE-Digital/apply-for-qualified-teacher-status that referenced this pull request Feb 20, 2026
@Hassanmir92
Fixing issue with Sentry errors not being sent as Sentry::ErrorEvent …
8b140d6
…no longer has a method to_hash. This has been changed to to_h

More information on this change can be found here: getsentry/sentry-ruby#2351
@nekketsuuu nekketsuuu mentioned this pull request Mar 14, 2026
Drop to_hash in SentryParameterFilter to support sentry-ruby v6 cookpad/blouson#22
Merged
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@sl0thentr0py sl0thentr0py sl0thentr0py approved these changes
@solnic solnic Awaiting requested review from solnic

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@st0012 @sl0thentr0py @solnic
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.