Class: Stoplight::Infrastructure::Storage::CompatibilityMetrics
- Inherits:
-
Object
- Object
- Stoplight::Infrastructure::Storage::CompatibilityMetrics
- Defined in:
- lib/stoplight/infrastructure/storage/compatibility_metrics.rb
Overview
Temporary adapter that bridges Domain::Storage::Metrics to existing DataStore.
This compatibility layer allows the metrics abstraction to be introduced without breaking existing data store implementations. It delegates all operations to the data store’s original methods.
This class will be removed in a future versions once all data stores have native metrics implementations.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#data_store ⇒ Object
readonly
Returns the value of attribute data_store.
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(data_store:, config:) ⇒ CompatibilityMetrics
constructor
A new instance of CompatibilityMetrics.
- #metrics_snapshot ⇒ Object
- #record_failure(error) ⇒ Object
- #record_success ⇒ Object
Constructor Details
#initialize(data_store:, config:) ⇒ CompatibilityMetrics
Returns a new instance of CompatibilityMetrics.
26 27 28 29 |
# File 'lib/stoplight/infrastructure/storage/compatibility_metrics.rb', line 26 def initialize(data_store:, config:) @data_store = data_store @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
24 25 26 |
# File 'lib/stoplight/infrastructure/storage/compatibility_metrics.rb', line 24 def config @config end |
#data_store ⇒ Object (readonly)
Returns the value of attribute data_store.
23 24 25 |
# File 'lib/stoplight/infrastructure/storage/compatibility_metrics.rb', line 23 def data_store @data_store end |
Instance Method Details
#clear ⇒ Object
37 |
# File 'lib/stoplight/infrastructure/storage/compatibility_metrics.rb', line 37 def clear = data_store.clear_metrics(config) |
#metrics_snapshot ⇒ Object
31 |
# File 'lib/stoplight/infrastructure/storage/compatibility_metrics.rb', line 31 def metrics_snapshot = data_store.get_metrics(config) |
#record_failure(error) ⇒ Object
35 |
# File 'lib/stoplight/infrastructure/storage/compatibility_metrics.rb', line 35 def record_failure(error) = data_store.record_failure(config, error) |
#record_success ⇒ Object
33 |
# File 'lib/stoplight/infrastructure/storage/compatibility_metrics.rb', line 33 def record_success = data_store.record_success(config) |