Class: Roma::Stats

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/roma/stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStats

Returns a new instance of Stats.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/roma/stats.rb', line 85

def initialize
  @config_path = nil
  @run_recover = false
  @run_sync_routing = false
  @run_iterate_storage = false
  @run_storage_clean_up = false
  @run_receive_a_vnode = {}
  @run_release = false
  @run_join = false
  @run_balance = false
  @gui_run_snapshot = false
  @gui_run_gather_logs = false
  @last_clean_up = Time.now
  @gui_last_snapshot = []
  @spushv_protection = false
  @stream_copy_wait_param = 0.0001
  @stream_show_wait_param = 0.001
  @dcnice = 3
  @clean_up_interval = 300
  @enabled_vnodes_balance = nil
  @write_count = 0
  @read_count = 0
  @delete_count = 0
  @out_count = 0
  @out_message_count = 0
  @redundant_count = 0
  @size_of_zredundant = 0
  @hilatency_warn_time = 5.0
  @wb_command_map = {}
  @latency_log = false
  @latency_check_cmd =["get", "set", "delete"]
  @latency_check_time_count = false
  @latency_data = Hash.new { |hash,key| hash[key] = {} } #double hash
  @spushv_klength_warn = 1024 # 1kB
  @spushv_vlength_warn = 1024 * 1024 # 1MB
  @spushv_read_timeout = 100
  @reqpushv_timeout_count = 300 # 0.1 * 300 sec
  @routing_trans_timeout = 3600 * 3 # 3hr
  @log_shift_size = 1048576
  @log_shift_age = 0
  @log_level = :debug
end

Instance Attribute Details

#addressObject

command options



12
13
14
# File 'lib/roma/stats.rb', line 12

def address
  @address
end

#clean_up_intervalObject

Returns the value of attribute clean_up_interval.



42
43
44
# File 'lib/roma/stats.rb', line 42

def clean_up_interval
  @clean_up_interval
end

#config_pathObject

environment options



9
10
11
# File 'lib/roma/stats.rb', line 9

def config_path
  @config_path
end

#daemonObject

Returns the value of attribute daemon.



13
14
15
# File 'lib/roma/stats.rb', line 13

def daemon
  @daemon
end

#dcniceObject

Returns the value of attribute dcnice.



41
42
43
# File 'lib/roma/stats.rb', line 41

def dcnice
  @dcnice
end

#delete_countObject

Returns the value of attribute delete_count.



50
51
52
# File 'lib/roma/stats.rb', line 50

def delete_count
  @delete_count
end

#disabled_cmd_protectObject

Returns the value of attribute disabled_cmd_protect.



20
21
22
# File 'lib/roma/stats.rb', line 20

def disabled_cmd_protect
  @disabled_cmd_protect
end

#enabled_repetition_host_in_routingObject Also known as: rep_host

Returns the value of attribute enabled_repetition_host_in_routing.



18
19
20
# File 'lib/roma/stats.rb', line 18

def enabled_repetition_host_in_routing
  @enabled_repetition_host_in_routing
end

#enabled_vnodes_balanceObject

proc mode



23
24
25
# File 'lib/roma/stats.rb', line 23

def enabled_vnodes_balance
  @enabled_vnodes_balance
end

#gui_last_snapshotObject

Returns the value of attribute gui_last_snapshot.



78
79
80
# File 'lib/roma/stats.rb', line 78

def gui_last_snapshot
  @gui_last_snapshot
end

#gui_run_gather_logsObject

Returns the value of attribute gui_run_gather_logs.



77
78
79
# File 'lib/roma/stats.rb', line 77

def gui_run_gather_logs
  @gui_run_gather_logs
end

#gui_run_snapshotObject

for GUI tool



76
77
78
# File 'lib/roma/stats.rb', line 76

def gui_run_snapshot
  @gui_run_snapshot
end

#hilatency_warn_timeObject

Returns the value of attribute hilatency_warn_time.



55
56
57
# File 'lib/roma/stats.rb', line 55

def hilatency_warn_time
  @hilatency_warn_time
end

#join_apObject

Returns the value of attribute join_ap.



14
15
16
# File 'lib/roma/stats.rb', line 14

def join_ap
  @join_ap
end

#last_clean_upObject

Returns the value of attribute last_clean_up.



35
36
37
# File 'lib/roma/stats.rb', line 35

def last_clean_up
  @last_clean_up
end

#latency_check_cmdObject

Returns the value of attribute latency_check_cmd.



62
63
64
# File 'lib/roma/stats.rb', line 62

def latency_check_cmd
  @latency_check_cmd
end

#latency_check_time_countObject

Returns the value of attribute latency_check_time_count.



63
64
65
# File 'lib/roma/stats.rb', line 63

def latency_check_time_count
  @latency_check_time_count
end

#latency_dataObject

Returns the value of attribute latency_data.



64
65
66
# File 'lib/roma/stats.rb', line 64

def latency_data
  @latency_data
end

#latency_logObject

for latency average check



61
62
63
# File 'lib/roma/stats.rb', line 61

def latency_log
  @latency_log
end

#log_levelObject

Returns the value of attribute log_level.



83
84
85
# File 'lib/roma/stats.rb', line 83

def log_level
  @log_level
end

#log_shift_ageObject

Returns the value of attribute log_shift_age.



82
83
84
# File 'lib/roma/stats.rb', line 82

def log_shift_age
  @log_shift_age
end

#log_shift_sizeObject

for log



81
82
83
# File 'lib/roma/stats.rb', line 81

def log_shift_size
  @log_shift_size
end

#nameObject

Returns the value of attribute name.



16
17
18
# File 'lib/roma/stats.rb', line 16

def name
  @name
end

#out_countObject

Returns the value of attribute out_count.



51
52
53
# File 'lib/roma/stats.rb', line 51

def out_count
  @out_count
end

#out_message_countObject

Returns the value of attribute out_message_count.



52
53
54
# File 'lib/roma/stats.rb', line 52

def out_message_count
  @out_message_count
end

#portObject

command options



12
13
14
# File 'lib/roma/stats.rb', line 12

def port
  @port
end

#read_countObject

Returns the value of attribute read_count.



49
50
51
# File 'lib/roma/stats.rb', line 49

def read_count
  @read_count
end

#redundant_countObject

Returns the value of attribute redundant_count.



53
54
55
# File 'lib/roma/stats.rb', line 53

def redundant_count
  @redundant_count
end

#reqpushv_timeout_countObject

Returns the value of attribute reqpushv_timeout_count.



71
72
73
# File 'lib/roma/stats.rb', line 71

def reqpushv_timeout_count
  @reqpushv_timeout_count
end

#routing_trans_timeoutObject

Returns the value of attribute routing_trans_timeout.



73
74
75
# File 'lib/roma/stats.rb', line 73

def routing_trans_timeout
  @routing_trans_timeout
end

#run_balanceObject

Returns the value of attribute run_balance.



33
34
35
# File 'lib/roma/stats.rb', line 33

def run_balance
  @run_balance
end

#run_iterate_storageObject

Returns the value of attribute run_iterate_storage.



28
29
30
# File 'lib/roma/stats.rb', line 28

def run_iterate_storage
  @run_iterate_storage
end

#run_joinObject

Returns the value of attribute run_join.



32
33
34
# File 'lib/roma/stats.rb', line 32

def run_join
  @run_join
end

#run_receive_a_vnodeObject

Returns the value of attribute run_receive_a_vnode.



30
31
32
# File 'lib/roma/stats.rb', line 30

def run_receive_a_vnode
  @run_receive_a_vnode
end

#run_recoverObject

proc status



26
27
28
# File 'lib/roma/stats.rb', line 26

def run_recover
  @run_recover
end

#run_releaseObject

Returns the value of attribute run_release.



31
32
33
# File 'lib/roma/stats.rb', line 31

def run_release
  @run_release
end

#run_storage_clean_upObject

Returns the value of attribute run_storage_clean_up.



29
30
31
# File 'lib/roma/stats.rb', line 29

def run_storage_clean_up
  @run_storage_clean_up
end

#run_sync_routingObject

Returns the value of attribute run_sync_routing.



27
28
29
# File 'lib/roma/stats.rb', line 27

def run_sync_routing
  @run_sync_routing
end

#size_of_zredundantObject

compressed redundant param



45
46
47
# File 'lib/roma/stats.rb', line 45

def size_of_zredundant
  @size_of_zredundant
end

#spushv_klength_warnObject

for vnode copy parameter



68
69
70
# File 'lib/roma/stats.rb', line 68

def spushv_klength_warn
  @spushv_klength_warn
end

#spushv_protectionObject

Returns the value of attribute spushv_protection.



36
37
38
# File 'lib/roma/stats.rb', line 36

def spushv_protection
  @spushv_protection
end

#spushv_read_timeoutObject

Returns the value of attribute spushv_read_timeout.



70
71
72
# File 'lib/roma/stats.rb', line 70

def spushv_read_timeout
  @spushv_read_timeout
end

#spushv_vlength_warnObject

Returns the value of attribute spushv_vlength_warn.



69
70
71
# File 'lib/roma/stats.rb', line 69

def spushv_vlength_warn
  @spushv_vlength_warn
end

#start_with_failoverObject

Returns the value of attribute start_with_failover.



15
16
17
# File 'lib/roma/stats.rb', line 15

def start_with_failover
  @start_with_failover
end

#stream_copy_wait_paramObject

proc param



39
40
41
# File 'lib/roma/stats.rb', line 39

def stream_copy_wait_param
  @stream_copy_wait_param
end

#stream_show_wait_paramObject

Returns the value of attribute stream_show_wait_param.



40
41
42
# File 'lib/roma/stats.rb', line 40

def stream_show_wait_param
  @stream_show_wait_param
end

#verboseObject

Returns the value of attribute verbose.



17
18
19
# File 'lib/roma/stats.rb', line 17

def verbose
  @verbose
end

#wb_command_mapObject

for write behind



58
59
60
# File 'lib/roma/stats.rb', line 58

def wb_command_map
  @wb_command_map
end

#write_countObject

performance counter



48
49
50
# File 'lib/roma/stats.rb', line 48

def write_count
  @write_count
end

Instance Method Details

#ap_strObject



128
129
130
# File 'lib/roma/stats.rb', line 128

def ap_str
  "#{@address}_#{port}"
end

#clear_countersObject



180
181
182
183
184
185
186
187
# File 'lib/roma/stats.rb', line 180

def clear_counters
  clear_count(:@write_count)
  clear_count(:@read_count)
  clear_count(:@delete_count)
  clear_count(:@out_count)
  clear_count(:@out_message_count)
  clear_count(:@redundant_count)
end

#do_clean_up?Boolean

Returns:

  • (Boolean)


189
190
191
# File 'lib/roma/stats.rb', line 189

def do_clean_up?
  @last_clean_up.to_i + @clean_up_interval < Time.now.to_i
end

#get_statObject



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/roma/stats.rb', line 132

def get_stat
  ret = {}
  ret['stats.config_path'] = @config_path
  ret['stats.address'] = @address
  ret['stats.port'] = @port
  ret['stats.daemon'] = @daemon
  ret['stats.name'] = @name
  ret['stats.verbose'] = @verbose
  ret['stats.enabled_repetition_host_in_routing'] = rep_host
  ret['stats.run_recover'] = @run_recover
  ret['stats.run_sync_routing'] = @run_sync_routing
  ret['stats.run_iterate_storage'] = @run_iterate_storage
  ret['stats.run_storage_clean_up'] = @run_storage_clean_up
  ret['stats.run_receive_a_vnode'] = @run_receive_a_vnode.inspect
  ret['stats.run_release'] = @run_release
  ret['stats.run_join'] = @run_join
  ret['stats.run_balance'] = @run_balance
  ret['stats.gui_run_snapshot'] = @gui_run_snapshot
  ret['stats.last_clean_up'] = @last_clean_up
  ret['stats.gui_last_snapshot'] = @gui_last_snapshot
  ret['stats.spushv_protection'] = @spushv_protection
  ret['stats.stream_copy_wait_param'] = @stream_copy_wait_param
  ret['stats.stream_show_wait_param'] = @stream_show_wait_param
  ret['stats.dcnice'] = @dcnice
  ret['stats.clean_up_interval'] = @clean_up_interval
  ret['stats.size_of_zredundant'] = @size_of_zredundant
  ret['stats.write_count'] = @write_count
  ret['stats.read_count'] = @read_count
  ret['stats.delete_count'] = @delete_count
  ret['stats.out_count'] = @out_count
  ret['stats.out_message_count'] = @out_message_count
  ret['stats.redundant_count'] = @redundant_count
  ret['stats.hilatency_warn_time'] = @hilatency_warn_time
  ret['stats.wb_command_map'] = @wb_command_map.inspect
  ret['stats.latency_log']  = @latency_log
  ret['stats.latency_check_cmd']  = @latency_check_cmd
  ret['stats.latency_check_time_count']  = @latency_check_time_count
  ret['stats.spushv_klength_warn'] = @spushv_klength_warn
  ret['stats.spushv_vlength_warn'] = @spushv_vlength_warn
  ret['stats.spushv_read_timeout'] = @spushv_read_timeout
  ret['stats.reqpushv_timeout_count'] = @reqpushv_timeout_count
  ret['stats.routing_trans_timeout'] = @routing_trans_timeout
  ret['stats.log_shift_size'] = @log_shift_size
  ret['stats.log_shift_age'] = @log_shift_age
  ret['stats.log_level'] = @log_level
  ret
end