diff --git a/instrumentation/active_support/lib/opentelemetry/instrumentation/active_support/span_subscriber.rb b/instrumentation/active_support/lib/opentelemetry/instrumentation/active_support/span_subscriber.rb index c2a376ba3..5fd8c5cc2 100644 --- a/instrumentation/active_support/lib/opentelemetry/instrumentation/active_support/span_subscriber.rb +++ b/instrumentation/active_support/lib/opentelemetry/instrumentation/active_support/span_subscriber.rb @@ -30,7 +30,7 @@ def self.subscribe( subscriber_object = ::ActiveSupport::Notifications.subscribe(pattern, subscriber) - if Gem::Version.new(::Rails.version) < Gem::Version.new('7.2') + if ::ActiveSupport::Notifications.notifier.respond_to?(:synchronize) ::ActiveSupport::Notifications.notifier.synchronize do subscribers = ::ActiveSupport::Notifications.notifier.instance_variable_get(:@string_subscribers)[pattern]