Skip to content

refactor(sentry): take sentry-ruby/sentry-rails 7.0.0 without changing behaviour - #242

Merged
artempartos merged 2 commits into
developfrom
chore/sentry-7
Sep 11, 2026
Merged

artempartos merged 2 commits into
developfrom
chore/sentry-7

Conversation

@artempartos

Copy link
Copy Markdown
Contributor

Takes sentry-ruby / sentry-rails 6.7.0 → 7.0.0 with no change in what this app sends
to Sentry
. Supersedes #229 and #230, both of which were red.

Why the bare bump fails

config/initializers/sentry.rb set config.enable_logs, which 7.0.0 removed. Both dependabot
PRs died in the image build at assets:precompile:

NoMethodError: undefined method 'enable_logs=' for an instance of Sentry::Configuration

Backend and frontend checks fail together because they share that build.

What each 7.0 breaking change means here

enable_logs removed, Logs on by default. No replacement gate is needed. The only thing
that turns this app's ::Logger output into Sentry log events is the :logger patch, and that
is still opt-in through enabled_patches (register_patch(:logger) just lost its internal
if config.enable_logs). A console session keeps enabled_patches = [], so it still emits
nothing. Nothing in app/, lib/ or config/ calls Sentry.logger directly.

Rails structured logging — the one that actually changes. Under 6.7,
sentry-rails/configuration.rb had:

after(:configured) do
  rails.structured_logging.enabled = enable_logs if rails.structured_logging.enabled.nil?
end

so it followed enable_logs and was off in a console. 7.0 deletes that hook and defaults
@enabled to true, which would start shipping ActiveRecord + ActionController log
subscribers from rails console too. Set explicitly to !running_console — exactly the value
6.7 derived.

enable_metrics removed, Metrics on by default. No change: 6.7.0 already defaulted
enable_metrics to true (configuration.rb:582) and this app never set it.

config.otlp.setup_otlp_traces_exporter / setup_propagator default to false. Inert —
otlp is a sentry-opentelemetry option and that gem is not in the Gemfile.

send_default_pii deprecated. Left at true on purpose. send_default_pii= calls
DataCollection.backfill(self), which for a truthy value returns the permissive defaults —
i.e. 7.0 reproduces the old behaviour by construction. Hand-transcribing thirteen
data_collection.* fields for zero behavioural change is how you introduce a difference, not
how you avoid one. It costs one deprecation line at boot, and the real migration belongs in its
own PR before 8.0 removes the flag.

One deliberate small difference comes free with 7.0 and is kept: its new after(:configured)
hook folds Rails.application.config.filter_parameters into
data_collection.url_query_params, so query strings are filtered where 6.7 sent them whole.
That is strictly less PII leaving the app.

Also in this PR

Dropped the unrelated json 2.21.2 → 3.0.2 major that #230 resolved in as a rider.
sentry-ruby 7.0.0 does not depend on json at all, and the strictest constraint anywhere in
Gemfile.lock is json (>= 2.3), so 2.21.2 still satisfies the graph. A json major deserves
its own PR.

Verification

CI is the check that matters here: the failure mode is a boot-time NoMethodError during
assets:precompile, which the image build in both check jobs exercises before a single test
runs.

🤖 Generated with Claude Code

dependabot Bot and others added 2 commits September 11, 2026 22:01
Bumps [sentry-rails](https://github.com/getsentry/sentry-ruby) from 6.7.0 to 7.0.0.
- [Release notes](https://github.com/getsentry/sentry-ruby/releases)
- [Changelog](https://github.com/getsentry/sentry-ruby/blob/master/CHANGELOG.md)
- [Commits](getsentry/sentry-ruby@6.7.0...7.0.0)

Signed-off-by: Artem Petrov <[email protected]>

---
updated-dependencies:
- dependency-name: sentry-rails
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
sentry-ruby 7.0.0 removes `enable_logs`, which the initializer set, so the gem
bump alone dies at boot with `undefined method 'enable_logs=' for an instance of
Sentry::Configuration` — the image build fails at assets:precompile.

Dropping the line is not enough. Under 6.7 `rails.structured_logging.enabled`
was derived from `enable_logs` in an `after(:configured)` hook, so a `rails
console` session shipped no Rails log subscribers; 7.0 defaults it to true
unconditionally. Set it explicitly to the value 6.7 derived.

Logs themselves need no replacement gate: the `:logger` patch that turns this
app's ::Logger output into Sentry log events is still opt-in through
`enabled_patches`, and a console session still gets none. Metrics were already
on (6.7 defaulted `enable_metrics` to true), and `config.otlp.*` flipping to
false is inert without sentry-opentelemetry, which this app does not install.

Also drops the unrelated json 2.21.2 -> 3.0.2 rider dependabot resolved in;
nothing in the tree asks for more than `json >= 2.3`.

`send_default_pii = true` stays for now — 7.0 backfills `data_collection` from
it, so behaviour is unchanged. Migrating to explicit `data_collection` is its
own task before 8.0 removes the flag.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Signed-off-by: Artem Petrov <[email protected]>
@artempartos
artempartos merged commit 813be60 into develop Sep 11, 2026
7 checks passed
artempartos added a commit that referenced this pull request Sep 12, 2026
…253)

sentry-ruby 7.0.0 removed `enable_logs`, and #242 migrated
config/initializers/sentry.rb for it — but bin/temporal_worker calls
Sentry.init a second time, with its own DSN, after config/environment.
That call kept the flag, so the worker raised NoMethodError from inside
Sentry.init and died on boot.

Nothing but the initializer is loaded by `assets:precompile`, so the
image built green and the failure only appeared in the cluster: every
worker-ruby pod hit CrashLoopBackOff, no one polled the Temporal task
queue, and every WorkflowRun created afterwards sat in `pending`
indefinitely — which reads on screen as sessions waiting on a
concurrency limit that is nowhere near full.

No behaviour to preserve: under 7.0 logs are unconditionally on, and
this init sets no enabled_patches, so the `:logger` patch that would
turn the worker's own log output into Sentry log events stays off.

Signed-off-by: Artem Petrov <[email protected]>
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant