diff --git a/Gemfile b/Gemfile index 34f489c5c9e4..92dcb1f08783 100644 --- a/Gemfile +++ b/Gemfile @@ -117,6 +117,8 @@ gem 'flipper' gem 'flipper-active_record' gem 'flipper-ui' +gem "activesupport" + group :production, :staging do gem 'ddtrace' gem 'unicorn-worker-killer' diff --git a/Gemfile.lock b/Gemfile.lock index 631b86dde368..b400250ef8dc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -613,6 +613,7 @@ DEPENDENCIES activerecord-import activerecord-postgresql-adapter activerecord-session_store + activesupport acts-as-taggable-on (~> 7.0) acts_as_list (= 1.0.3) andand diff --git a/config/initializers/flipper.rb b/config/initializers/flipper.rb index 96e1ce03eb7d..c3596a80a9bd 100644 --- a/config/initializers/flipper.rb +++ b/config/initializers/flipper.rb @@ -1,9 +1,12 @@ require "flipper" require "flipper/adapters/active_record" +require "flipper/instrumentation/log_subscriber" Flipper.configure do |config| config.default do - Flipper.new(Flipper::Adapters::ActiveRecord.new) + adapter = Flipper::Adapters::ActiveRecord.new + instrumented = Flipper::Adapters::Instrumented.new(adapter, instrumenter: ActiveSupport::Notifications) + Flipper.new(instrumented, instrumenter: ActiveSupport::Notifications) end end Rails.configuration.middleware.use Flipper::Middleware::Memoizer, preload_all: true