Class: Flipper::Adapters::Instrumented
Constant Summary collapse
- InstrumentationName =
Private: The name of instrumentation events.
"adapter_operation.#{InstrumentationNamespace}"
Instance Attribute Summary collapse
-
#instrumenter ⇒ Object
readonly
Private: What is used to instrument all the things.
Instance Method Summary collapse
-
#add(feature) ⇒ Object
Public.
-
#clear(feature) ⇒ Object
Public.
-
#disable(feature, gate, thing) ⇒ Object
Public.
-
#enable(feature, gate, thing) ⇒ Object
Public.
-
#features ⇒ Object
Public.
-
#get(feature) ⇒ Object
Public.
-
#initialize(adapter, options = {}) ⇒ Instrumented
constructor
Internal: Initializes a new adapter instance.
-
#remove(feature) ⇒ Object
Public.
Constructor Details
#initialize(adapter, options = {}) ⇒ Instrumented
Internal: Initializes a new adapter instance.
adapter - Vanilla adapter instance to wrap.
options - The Hash of options.
:instrumenter - What to use to instrument all the things.
20 21 22 23 24 |
# File 'lib/flipper/adapters/instrumented.rb', line 20 def initialize(adapter, = {}) super(adapter) @name = :instrumented @instrumenter = .fetch(:instrumenter, Flipper::Instrumenters::Noop) end |
Instance Attribute Details
#instrumenter ⇒ Object (readonly)
Private: What is used to instrument all the things.
11 12 13 |
# File 'lib/flipper/adapters/instrumented.rb', line 11 def instrumenter @instrumenter end |
Instance Method Details
#add(feature) ⇒ Object
Public
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/flipper/adapters/instrumented.rb', line 39 def add(feature) payload = { :operation => :add, :adapter_name => name, :feature_name => feature.name, } @instrumenter.instrument(InstrumentationName, payload) { |payload| payload[:result] = super } end |
#clear(feature) ⇒ Object
Public
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/flipper/adapters/instrumented.rb', line 65 def clear(feature) payload = { :operation => :clear, :adapter_name => name, :feature_name => feature.name, } @instrumenter.instrument(InstrumentationName, payload) { |payload| payload[:result] = super } end |
#disable(feature, gate, thing) ⇒ Object
Public
105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/flipper/adapters/instrumented.rb', line 105 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 } end |
#enable(feature, gate, thing) ⇒ Object
Public
91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/flipper/adapters/instrumented.rb', line 91 def enable(feature, gate, thing) payload = { :operation => :enable, :adapter_name => name, :feature_name => feature.name, :gate_name => gate.name, } @instrumenter.instrument(InstrumentationName, payload) { |payload| payload[:result] = super } end |
#features ⇒ Object
Public
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/flipper/adapters/instrumented.rb', line 27 def features payload = { :operation => :features, :adapter_name => name, } @instrumenter.instrument(InstrumentationName, payload) { |payload| payload[:result] = super } end |
#get(feature) ⇒ Object
Public
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/flipper/adapters/instrumented.rb', line 78 def get(feature) payload = { :operation => :get, :adapter_name => name, :feature_name => feature.name, } @instrumenter.instrument(InstrumentationName, payload) { |payload| payload[:result] = super } end |
#remove(feature) ⇒ Object
Public
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/flipper/adapters/instrumented.rb', line 52 def remove(feature) payload = { :operation => :remove, :adapter_name => name, :feature_name => feature.name, } @instrumenter.instrument(InstrumentationName, payload) { |payload| payload[:result] = super } end |