Sha256: ded5fc53ef38ad8b08a21964d37e4f6e41b8e860c3336fa932560de68e799aef

Contents?: true

Size: 647 Bytes

Versions: 22

Compression:

Stored size: 647 Bytes

Contents

Server.api :stats, :admin 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

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rhoconnect-3.2.1 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.2.0 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.2.0.beta5 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.2.0.beta4 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.2.0.beta3 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.2.0.beta2 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.2.0.beta1 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.1.2 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.1.1 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.1.0 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.1.0.beta2 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.1.0.beta1 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.0.6 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.0.5 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.0.4 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.0.3 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.0.2 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.0.1 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.0.0 lib/rhoconnect/api/admin/stats.rb
rhoconnect-3.0.0.rc1 lib/rhoconnect/api/admin/stats.rb