Sha256: a53e1368f6129b73b128082fd7828110c2f6ca9e6470193934557c7e3bb3a49d
Contents?: true
Size: 670 Bytes
Versions: 32
Compression:
Stored size: 670 Bytes
Contents
module Marty::Diagnostic; class Connections < Base self.aggregatable = false diagnostic_fn do conns = Node.get_postgres_connections[Database.db_name]. sort_by{|h| [h['application_name'], h['pid'], h['client_addr'], h['state']]} counts = Hash.new(0) conns.each_with_object({}) do |c, h| c['client_addr'] = 'localhost' unless c['client_addr'] name = c['application_name'] counts[name] += 1 key = "#{name} #{'*' * (counts[name]-1)}" h[key] = c.except('application_name').map{|k,v| "<li>#{k}: #{v}</li>"}.join end end end end
Version data entries
32 entries across 32 versions & 1 rubygems