Permalink
Browse files

Add heartbeat request

  • Loading branch information...
1 parent 6f7f56e commit 96cdbed2c5b8ec785587282dd77756e30e25b732 @rwdaigle committed Oct 9, 2012
Showing with 26 additions and 0 deletions.
  1. +23 −0 app/controllers/monitors_controller.rb
  2. +3 −0 config/routes.rb
@@ -0,0 +1,23 @@
+class MonitorsController < ApplicationController
+
+ def heartbeat
+ respond_to do |format|
+ format.json do
+ render :json => {
+ 'search' => test_search.any?,
+ 'db' => !Gist.order(:id).first.nil?,
+ 'cache' => !Rails.cache.exist?('monitors-heartbeat-foobar')
+ }
+ end
+ end
+ end
+
+ private
+
+ def test_search
+ Gist.tire.search do
+ query { string "*" }
+ size 1
+ end
+ end
+end
View
@@ -8,6 +8,9 @@
match '/auth/github/callback', to: 'sessions#create', :via => [:post, :get], :as => :github_auth_callback
match '/auth/failure', to: 'sessions#failure'
+ # Monitoring
+ match '/heartbeat', to: 'monitors#heartbeat', :as => :heartbeat
+
# Though this was an option at one time?
all = [:index, :show, :new, :create, :edit, :update, :destroy]

0 comments on commit 96cdbed

Please sign in to comment.