Skip to content

Commit

Permalink
Instrument Flipper with ActiveSupport
Browse files Browse the repository at this point in the history
  • Loading branch information
jibees committed Apr 15, 2021
1 parent 0c182c4 commit eb4c0a0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion config/initializers/flipper.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit eb4c0a0

Please sign in to comment.