From 1e0230aae29954ec83f95438b4052c32bf774cda Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Thu, 15 Apr 2021 14:04:58 +0200 Subject: [PATCH] Instrument Flipper with ActiveSupport --- config/initializers/flipper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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