Sha256: d86884245e1a9dd91166ff16bbc7a11981efe34da6f1da6a98d508a97940e6bf

Contents?: true

Size: 506 Bytes

Versions: 9

Compression:

Stored size: 506 Bytes

Contents

module Dexter
  class PgStatActivityParser < LogParser
    def perform
      queries = {}

      loop do
        new_queries = {}
        @logfile.stat_activity.each do |row|
          new_queries[row["id"]] = row
        end

        # store queries after they complete
        queries.each do |id, row|
          unless new_queries[id]
            process_entry(row["query"], row["duration_ms"].to_f)
          end
        end

        queries = new_queries

        sleep(1)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pgdexter-0.4.2 lib/dexter/pg_stat_activity_parser.rb
pgdexter-0.4.1 lib/dexter/pg_stat_activity_parser.rb
pgdexter-0.4.0 lib/dexter/pg_stat_activity_parser.rb
pgdexter-0.3.10 lib/dexter/pg_stat_activity_parser.rb
pgdexter-0.3.9 lib/dexter/pg_stat_activity_parser.rb
pgdexter-0.3.8 lib/dexter/pg_stat_activity_parser.rb
pgdexter-0.3.7 lib/dexter/pg_stat_activity_parser.rb
pgdexter-0.3.6 lib/dexter/pg_stat_activity_parser.rb
pgdexter-0.3.5 lib/dexter/pg_stat_activity_parser.rb