Module: ZuoraObservability::Metrics
- Defined in:
- lib/zuora_observability/metrics.rb
Overview
Methods to gather and format metrics
Class Method Summary collapse
Class Method Details
.resque ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/zuora_observability/metrics.rb', line 7 def resque Resque.redis.ping resque = Resque.info { app_name: ZuoraObservability::Env.app_name, url: 'dummy', Resque: { Jobs_Finished: resque[:processed], Jobs_Failed: resque[:failed], Jobs_Pending: resque[:pending], Workers_Active: resque[:working], Workers_Total: resque[:workers] } } end |
.unicorn_listener ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/zuora_observability/metrics.rb', line 33 def unicorn_listener stats_hash = {} stats_hash["total_active"] = 0 stats_hash["total_queued"] = 0 begin tmp = Unicorn.listener_names unix = tmp.grep(%r{\A/}) tcp = tmp.grep(/\A.+:\d+\z/) tcp = nil if tcp.empty? unix = nil if unix.empty? Raindrops::Linux.tcp_listener_stats(tcp).each do |addr,stats| stats_hash["active_#{addr}"] = stats.active stats_hash["queued_#{addr}"] = stats.queued stats_hash["total_active"] = stats.active + stats_hash["total_active"] stats_hash["total_queued"] = stats.queued + stats_hash["total_queued"] end if tcp Raindrops::Linux.unix_listener_stats(unix).each do |addr,stats| stats_hash["active_#{addr}"] = stats.active stats_hash["queued_#{addr}"] = stats.queued stats_hash["total_active"] = stats.active + stats_hash["total_active"] stats_hash["total_queued"] = stats.queued + stats_hash["total_queued"] end if unix rescue IOError => ex rescue => ex Rails.logger.error(ex) puts ex end return stats_hash end |
.versions ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/zuora_observability/metrics.rb', line 21 def versions { app_name: ZuoraObservability::Env.app_name, url: 'dummy', Version_Gem: ZuoraConnect::VERSION, Version_Zuora: ZuoraAPI::VERSION, Version_Ruby: RUBY_VERSION, Version_Rails: Rails.version, hold: 1 } end |