class Philae::MongoProbe

Attributes

name[R]

Public Class Methods

new(name, uri) click to toggle source
# File lib/philae/mongo_probe.rb, line 9
def initialize(name, uri)
  @name = name
  @uri = uri
end

Public Instance Methods

check() click to toggle source
# 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