Class: Flipper::Instrumentation::EventSubscriber
- Inherits:
-
Object
- Object
- Flipper::Instrumentation::EventSubscriber
- Defined in:
- lib/flipper/instrumentation/event_subscriber.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/flipper/instrumentation/event_subscriber.rb', line 8 def call(*) event = ActiveSupport::Notifications::Event.new(*) operation = event.payload[:operation] # Only log changes to toggle state. Don't log exist?, enabled?, state, on, off if %i[enable disable add remove clear].include? operation FeatureToggleEvent.create(feature_name: event.payload[:feature_name], operation:, gate_name: event.payload[:gate_name], value: event.payload[:thing]&.value, user: RequestStore.store[:flipper_user_email_for_log]) end end |