-
Notifications
You must be signed in to change notification settings - Fork 227
fix: remove call to ActiveSupport::Notifications.notifier#synchronize deprecated in Rails 7.2 #707
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
Changes from 3 commits
5f7808d
089d112
f630371
bb699be
5b29795
8c2c2e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,19 +30,21 @@ def self.subscribe( | |
|
|
||
| subscriber_object = ::ActiveSupport::Notifications.subscribe(pattern, subscriber) | ||
|
|
||
| ::ActiveSupport::Notifications.notifier.synchronize do | ||
| subscribers = ::ActiveSupport::Notifications.notifier.instance_variable_get(:@string_subscribers)[pattern] | ||
|
|
||
| if subscribers.nil? | ||
| OpenTelemetry.handle_error( | ||
| message: 'Unable to move OTEL ActiveSupport Notifications subscriber to the front of the notifications list which may cause incomplete traces.' \ | ||
| 'Please report an issue here: ' \ | ||
| 'https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues/new?labels=bug&template=bug_report.md&title=ActiveSupport%20Notifications%20subscribers%20list%20is%20nil' | ||
| ) | ||
| else | ||
| subscribers.unshift( | ||
| subscribers.delete(subscriber_object) | ||
| ) | ||
| if Gem::Version.new(::Rails.version) < Gem::Version.new('7.2') | ||
|
||
| ::ActiveSupport::Notifications.notifier.synchronize do | ||
| subscribers = ::ActiveSupport::Notifications.notifier.instance_variable_get(:@string_subscribers)[pattern] | ||
|
|
||
| if subscribers.nil? | ||
| OpenTelemetry.handle_error( | ||
| message: 'Unable to move OTEL ActiveSupport Notifications subscriber to the front of the notifications list which may cause incomplete traces.' \ | ||
| 'Please report an issue here: ' \ | ||
| 'https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues/new?labels=bug&template=bug_report.md&title=ActiveSupport%20Notifications%20subscribers%20list%20is%20nil' | ||
| ) | ||
| else | ||
| subscribers.unshift( | ||
| subscribers.delete(subscriber_object) | ||
| ) | ||
| end | ||
| end | ||
| end | ||
| subscriber_object | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.