Skip to content

Instantly share code, notes, and snippets.

@robdbirch
Created May 19, 2013 19:39
Show Gist options
  • Save robdbirch/5608719 to your computer and use it in GitHub Desktop.
Save robdbirch/5608719 to your computer and use it in GitHub Desktop.
God Middleware Condition
def middleware_up?
gps = God.status
applog @watch, :debug, "God Status: #{gps.inspect}"
(gps['mongo'][:state] == :up) and (gps['apollo'][:state] == :up)
end
class MiddlewareRunning < God::PollCondition
def initialize
super
LOG.level = God::Logger::DEBUG
end
def before
applog @watch, :debug, "Middleware BEFORE"
end
def after
applog @watch, :debug, "Middleware AFTER"
end
def valid?
applog @watch, :debug, "Middleware Valid"
super
end
def test
if middleware_up?
applog watch, :info, "Middleware Up"
true
else
false
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment