Class: SidekiqVigil::Check::RedisHealth
- Defined in:
- lib/sidekiq_vigil/check/redis_health.rb
Instance Attribute Summary
Attributes inherited from Base
#api, #clock, #logger, #options, #storage
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(storage:, options: {}, clock: -> { Time.now }, logger: SidekiqVigil.logger, api: SidekiqApi.new, monotonic_clock: -> { Process.clock_gettime(Process::CLOCK_MONOTONIC) }) ⇒ RedisHealth
constructor
A new instance of RedisHealth.
Methods inherited from Base
Constructor Details
#initialize(storage:, options: {}, clock: -> { Time.now }, logger: SidekiqVigil.logger, api: SidekiqApi.new, monotonic_clock: -> { Process.clock_gettime(Process::CLOCK_MONOTONIC) }) ⇒ RedisHealth
Returns a new instance of RedisHealth.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/sidekiq_vigil/check/redis_health.rb', line 6 def initialize( storage:, options: {}, clock: -> { Time.now }, logger: SidekiqVigil.logger, api: SidekiqApi.new, monotonic_clock: -> { Process.clock_gettime(Process::CLOCK_MONOTONIC) } ) super(storage:, options:, clock:, logger:, api:) @monotonic_clock = monotonic_clock end |
Instance Method Details
#call ⇒ Object
18 19 20 21 22 23 |
# File 'lib/sidekiq_vigil/check/redis_health.rb', line 18 def call started_at = monotonic_clock.call storage.ping latency_ms = (monotonic_clock.call - started_at) * 1_000 [latency_result(latency_ms), memory_result] end |