Module: Philiprehberger::Circuit::Metrics
- Included in:
- Breaker
- Defined in:
- lib/philiprehberger/circuit/metrics.rb
Overview
Thread-safe counters and state change log for monitoring
Instance Method Summary collapse
- #metrics ⇒ Object
-
#metrics_reset! ⇒ Object
Zero counters and clear the state-change log without altering the circuit’s current state or transition timestamps.
Instance Method Details
#metrics ⇒ Object
7 8 9 |
# File 'lib/philiprehberger/circuit/metrics.rb', line 7 def metrics @mutex.synchronize { metrics_snapshot } end |
#metrics_reset! ⇒ Object
Zero counters and clear the state-change log without altering the circuit’s current state or transition timestamps.
13 14 15 16 17 18 19 20 21 |
# File 'lib/philiprehberger/circuit/metrics.rb', line 13 def metrics_reset! @mutex.synchronize do @success_count = 0 @metrics_failure_count = 0 @rejected_count = 0 @state_changes = [] end self end |