Class: Readyset::Health::Healthchecks
- Inherits:
-
Object
- Object
- Readyset::Health::Healthchecks
- Defined in:
- lib/readyset/health/healthchecks.rb
Overview
Represents healthchecks that are run against ReadySet to determine whether ReadySet is in a state where it can serve queries.
Instance Method Summary collapse
-
#healthy? ⇒ Boolean
Checks if ReadySet is healthy by invoking ‘SHOW READYSET STATUS` and checking if ReadySet is connected to the upstream database.
-
#initialize(shard:) ⇒ Healthchecks
constructor
A new instance of Healthchecks.
Constructor Details
#initialize(shard:) ⇒ Healthchecks
Returns a new instance of Healthchecks.
6 7 8 |
# File 'lib/readyset/health/healthchecks.rb', line 6 def initialize(shard:) @shard = shard end |
Instance Method Details
#healthy? ⇒ Boolean
Checks if ReadySet is healthy by invoking ‘SHOW READYSET STATUS` and checking if ReadySet is connected to the upstream database.
14 15 16 17 18 19 20 |
# File 'lib/readyset/health/healthchecks.rb', line 14 def healthy? connection.execute('SHOW READYSET STATUS').any? do |row| row['name'] == 'Database Connection' && row['value'] == 'Connected' end rescue false end |