Sha256: d3416703b32261986701973b4a0ae1c98195e4d78db5994680facf83c4994515
Contents?: true
Size: 664 Bytes
Versions: 51
Compression:
Stored size: 664 Bytes
Contents
module Marty::Diagnostic; class Connections < Base self.aggregatable = false diagnostic_fn do conns = Node.get_postgres_connections[Database.db_name]. sort_by do |h| [h['application_name'], h['pid'], h['client_addr'], h['state']] end 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
51 entries across 51 versions & 1 rubygems