lib/flipper/adapters/instrumented.rb in flipper-0.5.0 vs lib/flipper/adapters/instrumented.rb in flipper-0.6.0

- old
+ new

@@ -21,67 +21,94 @@ super(adapter) @name = :instrumented @instrumenter = options.fetch(:instrumenter, Flipper::Instrumenters::Noop) end - def get(feature) + # Public + def features payload = { - :operation => :get, + :operation => :features, :adapter_name => name, + } + + @instrumenter.instrument(InstrumentationName, payload) { |payload| + payload[:result] = super + } + end + + # Public + def add(feature) + payload = { + :operation => :add, + :adapter_name => name, :feature_name => feature.name, } @instrumenter.instrument(InstrumentationName, payload) { |payload| payload[:result] = super } end - # Public: Enable feature gate for thing. - def enable(feature, gate, thing) + # Public + def remove(feature) payload = { - :operation => :enable, + :operation => :remove, :adapter_name => name, :feature_name => feature.name, - :gate_name => gate.name, } @instrumenter.instrument(InstrumentationName, payload) { |payload| payload[:result] = super } end - # Public: Disable feature gate for thing. - def disable(feature, gate, thing) + # Public + def clear(feature) payload = { - :operation => :disable, + :operation => :clear, :adapter_name => name, :feature_name => feature.name, - :gate_name => gate.name, } @instrumenter.instrument(InstrumentationName, payload) { |payload| payload[:result] = super } end - # Public: Returns all the features that the adapter knows of. - def features + # Public + def get(feature) payload = { - :operation => :features, + :operation => :get, :adapter_name => name, + :feature_name => feature.name, } @instrumenter.instrument(InstrumentationName, payload) { |payload| payload[:result] = super } end - # Internal: Adds a known feature to the set of features. - def add(feature) + # Public + def enable(feature, gate, thing) payload = { - :operation => :add, + :operation => :enable, :adapter_name => name, :feature_name => feature.name, + :gate_name => gate.name, + } + + @instrumenter.instrument(InstrumentationName, payload) { |payload| + payload[:result] = super + } + end + + # Public + def disable(feature, gate, thing) + payload = { + :operation => :disable, + :adapter_name => name, + :feature_name => feature.name, + :gate_name => gate.name, } @instrumenter.instrument(InstrumentationName, payload) { |payload| payload[:result] = super }