Class: Stoplight::Infrastructure::Storage::CompatibilityRecoveryMetrics
- Inherits:
-
Object
- Object
- Stoplight::Infrastructure::Storage::CompatibilityRecoveryMetrics
- Defined in:
- lib/stoplight/infrastructure/storage/compatibility_recovery_metrics.rb
Overview
When a circuit is RED (open), Stoplight periodically sends “recovery probes” to test whether the protected service has recovered. These test requests have different semantics than normal requests and their metrics are tracked separately.
Like CompatibilityMetrics, this adapter will be replaced with purpose-built recovery metrics implementations (e.g., ConsecutiveSuccessMetrics) once the metrics extraction is complete.
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(data_store:, config:) ⇒ CompatibilityRecoveryMetrics
constructor
A new instance of CompatibilityRecoveryMetrics.
- #metrics_snapshot ⇒ Object
-
#record_failure(error) ⇒ Object
Tracks failed circuit breaker execution.
-
#record_success ⇒ Object
Tracks successful circuit breaker execution.
Constructor Details
#initialize(data_store:, config:) ⇒ CompatibilityRecoveryMetrics
Returns a new instance of CompatibilityRecoveryMetrics.
25 26 27 28 |
# File 'lib/stoplight/infrastructure/storage/compatibility_recovery_metrics.rb', line 25 def initialize(data_store:, config:) @data_store = data_store @config = config end |
Instance Method Details
#clear ⇒ Object
38 |
# File 'lib/stoplight/infrastructure/storage/compatibility_recovery_metrics.rb', line 38 def clear = data_store.clear_recovery_metrics(config) |
#metrics_snapshot ⇒ Object
30 |
# File 'lib/stoplight/infrastructure/storage/compatibility_recovery_metrics.rb', line 30 def metrics_snapshot = data_store.get_recovery_metrics(config) |
#record_failure(error) ⇒ Object
Tracks failed circuit breaker execution
36 |
# File 'lib/stoplight/infrastructure/storage/compatibility_recovery_metrics.rb', line 36 def record_failure(error) = data_store.record_recovery_probe_failure(config, error) |
#record_success ⇒ Object
Tracks successful circuit breaker execution
33 |
# File 'lib/stoplight/infrastructure/storage/compatibility_recovery_metrics.rb', line 33 def record_success = data_store.record_recovery_probe_success(config) |