Class: Stoplight::Domain::Tracker::Request Private

Inherits:
Object
  • Object
show all
Defined in:
lib/stoplight/domain/tracker/request.rb

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 Method Summary collapse

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 Method Details

#record_failure(exception) ⇒ Object

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.



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_successObject

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.



28
# File 'lib/stoplight/domain/tracker/request.rb', line 28

def record_success = metrics_store.record_success