Class: Stoplight::Domain::Tracker::Request Private
- Defined in:
- lib/stoplight/domain/tracker/request.rb,
sig/_private/stoplight/domain/tracker/request.rbs
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Tracks request outcomes (success/failure) and manages state transitions for normal traffic.
Used by GreenRunStrategy to track failures and potentially open the circuit.
Instance Attribute Summary collapse
- #config ⇒ Config readonly private
- #metrics_store ⇒ _MetricsStore readonly private
- #notifiers ⇒ Array[state_transition_notifier] readonly private
- #state_store ⇒ _StateStore readonly private
- #traffic_control ⇒ _TrafficControl readonly private
Instance Method Summary collapse
-
#initialize(traffic_control:, notifiers:, config:, metrics_store:, state_store:) ⇒ Request
constructor
private
A new instance of Request.
- #record_failure(exception) ⇒ void private
- #record_success ⇒ void private
Constructor Details
#initialize(traffic_control:, notifiers:, config:, metrics_store:, state_store:) ⇒ Request
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Request.
13 14 15 16 17 18 19 |
# File 'lib/stoplight/domain/tracker/request.rb', line 13 def initialize(traffic_control:, notifiers:, config:, metrics_store:, state_store:) @traffic_control = traffic_control @notifiers = notifiers @config = config @metrics_store = metrics_store @state_store = state_store end |
Instance Attribute Details
#config ⇒ Config (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/stoplight/domain/tracker/request.rb', line 34 def config @config end |
#metrics_store ⇒ _MetricsStore (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 |
# File 'lib/stoplight/domain/tracker/request.rb', line 35 def metrics_store @metrics_store end |
#notifiers ⇒ Array[state_transition_notifier] (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 |
# File 'lib/stoplight/domain/tracker/request.rb', line 33 def notifiers @notifiers end |
#state_store ⇒ _StateStore (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
36 37 38 |
# File 'lib/stoplight/domain/tracker/request.rb', line 36 def state_store @state_store end |
#traffic_control ⇒ _TrafficControl (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
32 33 34 |
# File 'lib/stoplight/domain/tracker/request.rb', line 32 def traffic_control @traffic_control end |
Instance Method Details
#record_failure(exception) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
21 22 23 24 25 26 |
# File 'lib/stoplight/domain/tracker/request.rb', line 21 def record_failure(exception) metrics_store.record_failure(exception) metrics = metrics_store.metrics_snapshot transition_to_red(exception, metrics:) end |
#record_success ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
28 |
# File 'lib/stoplight/domain/tracker/request.rb', line 28 def record_success = metrics_store.record_success |