# Server.api4 :stats, :get, "/rc/#{Rhoconnect::API_VERSION}/system/stats", \ # true, {:verb => :post, :url => ['/api/stats', '/api/admin/stats']} do |params,user| # if Rhoconnect.stats == true # names = params[:names] # if names # Rhoconnect::Stats::Record.keys(names).to_json # else # metric = params[:metric] # rtype = Rhoconnect::Stats::Record.rtype(metric) # if rtype == 'zset' # # returns [] if no results # Rhoconnect::Stats::Record.range(metric,params[:start],params[:finish]).to_json # elsif rtype == 'string' # Rhoconnect::Stats::Record.get_value(metric) || '' # else # raise ApiException.new(404, "Unknown metric") # end # end # else # raise ApiException.new(500, "Stats not enabled") # end # end