Class: Philae::MongoProbe
- Inherits:
-
Object
- Object
- Philae::MongoProbe
- Defined in:
- lib/philae/mongo_probe.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #check ⇒ Object
-
#initialize(name, uri) ⇒ MongoProbe
constructor
A new instance of MongoProbe.
Constructor Details
#initialize(name, uri) ⇒ MongoProbe
Returns a new instance of MongoProbe.
9 10 11 12 |
# File 'lib/philae/mongo_probe.rb', line 9 def initialize(name, uri) @name = name @uri = uri end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/philae/mongo_probe.rb', line 7 def name @name end |
Instance Method Details
#check ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/philae/mongo_probe.rb', line 14 def check begin @client ||= Mongo::Client.new(@uri, max_read_retries: 1) db = @client.database db.collection_names @client.close rescue return { healthy: false, comment: 'Unable to contact mongo' } end return { healthy: true, comment: '' } end |