Class: SimpleApm::Redis
- Inherits:
-
Object
- Object
- SimpleApm::Redis
- Defined in:
- lib/simple_apm/redis.rb
Class Method Summary collapse
-
.in_apm_days ⇒ Object
所有统计的日期,通过hits来判断.
- .instance ⇒ Object
- .method_missing(method, *args) ⇒ Object
- .simple_info ⇒ Object
Class Method Details
.in_apm_days ⇒ Object
所有统计的日期,通过hits来判断
37 38 39 |
# File 'lib/simple_apm/redis.rb', line 37 def in_apm_days SimpleApm::Redis.keys('*:action-names').map{|x|x.split(':').first}.sort end |
.instance ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/simple_apm/redis.rb', line 7 def instance @current ||= ::Redis::Namespace.new( :simple_apm, :redis => ::Redis.new( url: SimpleApm::Setting::REDIS_URL, driver: SimpleApm::Setting::REDIS_DRIVER ) ) end |
.method_missing(method, *args) ⇒ Object
41 42 43 44 45 |
# File 'lib/simple_apm/redis.rb', line 41 def method_missing(method, *args) instance.send(method, *args) rescue NoMethodError super(method, *args) end |
.simple_info ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/simple_apm/redis.rb', line 18 def simple_info h = {} redis.info.each do |k, v| if k == 'total_system_memory_human' h['系统内存'] = v elsif k == 'used_memory_rss_human' h['当前内存占用(rss)'] = v elsif k == 'used_memory_peak_human' h['占用内存峰值'] = v elsif k == 'redis_version' h['redis版本'] = v elsif k =~ /db[0-9]+/ h[k] = v end end h end |