getsentry / sentry-ruby

Sentry SDK for Ruby
https://sentry.io/for/ruby
MIT License
926 stars 493 forks source link

Avoid invoking ActiveSupport::BroadcastLogger if not defined #2169

Closed PetrHeinz closed 10 months ago

PetrHeinz commented 10 months ago

Description

When ::ActiveSupport::BroadcastLogger is not defined (Rails < 7.1) and ::Rails.logger instance has broadcasts method defined, initialization of Sentry-ruby fails on NameError: uninitialized constant ActiveSupport::BroadcastLogger (NameError).

I suggest changing the check to ::Rails.logger being an instance of ::ActiveSupport::BroadcastLogger (with a defined? check).

codecov[bot] commented 10 months ago

Codecov Report

Merging #2169 (6f46a71) into master (e082644) will increase coverage by 0.09%. Report is 2 commits behind head on master. The diff coverage is 100.00%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2169 +/- ## ========================================== + Coverage 97.30% 97.40% +0.09% ========================================== Files 97 98 +1 Lines 3638 3655 +17 ========================================== + Hits 3540 3560 +20 + Misses 98 95 -3 ``` | [Components](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2169/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | Coverage Δ | | |---|---|---| | [sentry-ruby](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2169/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | `98.02% <ø> (+<0.01%)` | :arrow_up: | | [sentry-rails](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2169/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | `94.98% <100.00%> (ø)` | | | [sentry-sidekiq](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2169/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | `95.54% <ø> (+1.83%)` | :arrow_up: | | [sentry-resque](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2169/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | `93.65% <ø> (+1.58%)` | :arrow_up: | | [sentry-delayed_job](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2169/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | `94.36% <ø> (ø)` | | | [sentry-opentelemetry](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2169/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | `100.00% <ø> (ø)` | | | [Files](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2169?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry) | Coverage Δ | | |---|---|---| | [sentry-rails/lib/sentry/rails/configuration.rb](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2169?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry#diff-c2VudHJ5LXJhaWxzL2xpYi9zZW50cnkvcmFpbHMvY29uZmlndXJhdGlvbi5yYg==) | `97.14% <100.00%> (ø)` | | ... and [4 files with indirect coverage changes](https://app.codecov.io/gh/getsentry/sentry-ruby/pull/2169/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getsentry)