Class: KRL_CMD::Stats
- Inherits:
-
Object
- Object
- KRL_CMD::Stats
- Defined in:
- lib/stats.rb
Class Method Summary collapse
- .account_kpis(options) ⇒ Object
- .interface ⇒ Object
- .kpis(options) ⇒ Object
- .logging(options) ⇒ Object
- .query(options) ⇒ Object
Class Method Details
.account_kpis(options) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/stats.rb', line 34 def self.account_kpis() user = KRL_CMD::User.new begin data = user.kpis([], ["range"]) display_stats(data, %w(RULESET DAY RSE BRSE CALLBACKS RULES RULES_FIRED ACTIONS), ["format"]) rescue => e ap e. if $DEBUG ap e.backtrace if $DEBUG raise e. end end |
.interface ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/stats.rb', line 4 def self.interface user = KRL_CMD::User.new begin p_interface = user.stats_interface puts "-- Dimensions --" p_interface["dims"].each {|s| puts "\t" + s} puts puts "-- KPIS --" p_interface["kpis"].each {|s| puts "\t" + s} puts puts "-- Ranges --" p_interface["ranges"].each {|s| puts "\t" + s} rescue raise "There was an error trying to retrieve the stats interface" end end |
.kpis(options) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/stats.rb', line 21 def self.kpis() app = KRL_COMMON::get_app begin data = app.kpis(["range"]) display_stats(data, %w(DAY RSE BRSE CALLBACKS RULES RULES_FIRED ACTIONS), ["format"]) rescue => e ap e. if $DEBUG ap e.backtrace if $DEBUG raise e. end end |
.logging(options) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/stats.rb', line 46 def self.logging() app = KRL_COMMON::get_app begin data = app.logging(["range"]) display_stats(data, [], "json") rescue => e ap e. if $DEBUG ap e.backtrace if $DEBUG raise e. end end |
.query(options) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/stats.rb', line 58 def self.query() user = KRL_CMD::User.new if ["conditions"] conditions = [] ["conditions"].each {|k,v| conditions << {:field => k, :value => v}} else conditions = nil end begin data = user.api.get_stats_query( ["kpis"].join(","), ["dims"].join(","), conditions, ["range"] ) fields = [] (["dims"] + ["kpis"]).each {|v| fields << v.upcase} display_stats(data, fields, ["format"]) rescue => e ap e. #if $DEBUG ap e.backtrace #if $DEBUG raise "Unable to retrieve query results. #{e.}" end end |