Skip to content

feat(logging): auto-enable structured_logging in Rails#2721

Merged
solnic merged 5 commits into
masterfrom
2715-remove-double-opt-in-for-logs-in-rails
Sep 25, 2025
Merged

feat(logging): auto-enable structured_logging in Rails#2721
solnic merged 5 commits into
masterfrom
2715-remove-double-opt-in-for-logs-in-rails

Conversation

@solnic

@solnic solnic commented Sep 24, 2025

Copy link
Copy Markdown
Collaborator

When config.enable_logs is true, enable structured logging in Rails automatically too.

Closes #2715

@solnic solnic linked an issue Sep 24, 2025 that may be closed by this pull request
@github-actions

github-actions Bot commented Sep 24, 2025

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against cdcfa2f

@solnic
solnic force-pushed the 2715-remove-double-opt-in-for-logs-in-rails branch from 3fe30dc to 5fa0cbd Compare September 24, 2025 12:17
@codecov

codecov Bot commented Sep 24, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.31%. Comparing base (43e5788) to head (cdcfa2f).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2721      +/-   ##
==========================================
+ Coverage   97.29%   97.31%   +0.01%     
==========================================
  Files         144      144              
  Lines        5665     5669       +4     
==========================================
+ Hits         5512     5517       +5     
+ Misses        153      152       -1     
Components Coverage Δ
sentry-ruby 97.76% <ø> (ø)
sentry-rails 95.74% <100.00%> (+0.12%) ⬆️
sentry-sidekiq 96.57% <ø> (ø)
sentry-resque 94.44% <ø> (ø)
sentry-delayed_job 94.68% <ø> (ø)
sentry-opentelemetry 99.31% <ø> (ø)
Files with missing lines Coverage Δ
sentry-rails/lib/sentry/rails/configuration.rb 100.00% <100.00%> (ø)
sentry-rails/lib/sentry/rails/railtie.rb 98.83% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@solnic
solnic force-pushed the 2715-remove-double-opt-in-for-logs-in-rails branch 2 times, most recently from f18b5b5 to 2b44976 Compare September 24, 2025 13:58
@solnic
solnic marked this pull request as ready for review September 24, 2025 14:40
@solnic
solnic requested a review from sl0thentr0py September 24, 2025 14:40
@solnic

solnic commented Sep 24, 2025

Copy link
Copy Markdown
Collaborator Author

@sl0thentr0py feeling so-so about how I implemented it but it is the simplest thing that worked. The drawback is that I made enabled attribute reader private. A couple of alternatives that I tried involved a new callback in Configuration or overidding enabled= in Configuration, and both felt even worse 😅

Comment thread sentry-rails/lib/sentry/rails/configuration.rb Outdated
@solnic
solnic requested a review from sl0thentr0py September 25, 2025 09:01
@solnic
solnic force-pushed the 2715-remove-double-opt-in-for-logs-in-rails branch from 2b44976 to 9e54a77 Compare September 25, 2025 09:03
cursor[bot]

This comment was marked as outdated.

@solnic
solnic force-pushed the 2715-remove-double-opt-in-for-logs-in-rails branch from 9e54a77 to 8177efb Compare September 25, 2025 09:11
When config.enable_logs is true, enable structured
logging in Rails automatically too.

Closes #2715
@solnic
solnic force-pushed the 2715-remove-double-opt-in-for-logs-in-rails branch from 8177efb to 4404bb6 Compare September 25, 2025 11:55
cursor[bot]

This comment was marked as outdated.

@solnic
solnic force-pushed the 2715-remove-double-opt-in-for-logs-in-rails branch from 4404bb6 to bcb4def Compare September 25, 2025 12:08
cursor[bot]

This comment was marked as outdated.

@sl0thentr0py sl0thentr0py left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small nit/leftover, otherwise 🚢

Comment thread sentry-rails/lib/sentry/rails/configuration.rb Outdated
@solnic
solnic merged commit 2c8c2c1 into master Sep 25, 2025
269 of 270 checks passed
@solnic
solnic deleted the 2715-remove-double-opt-in-for-logs-in-rails branch September 25, 2025 13:49
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.

Remove double opt-in for Logs in Rails

2 participants