Skip to content

Commit

Permalink
made sure we skip non HODEL 3000 compliant lines from the log
Browse files Browse the repository at this point in the history
  • Loading branch information
Michel Barbosa committed Jan 7, 2010
1 parent cbb4562 commit 0a6edeb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/oink/memory_usage_reporter.rb
Expand Up @@ -6,6 +6,7 @@
module Oink

class MemoryUsageReporter < Base
HODEL_LOG_FORMAT_REGEX = /^(\w+ \d{2} \d{2}:\d{2}:\d{2})/

def print(output)
output.puts "---- MEMORY THRESHOLD ----"
Expand All @@ -15,6 +16,9 @@ def print(output)

@inputs.each do |input|
input.each_line do |line|
# Skip this line since we're only interested in the Hodel 3000 compliant lines
next unless line =~ HODEL_LOG_FORMAT_REGEX

line = line.strip

if line =~ /rails\[(\d+)\]/
Expand Down Expand Up @@ -44,7 +48,7 @@ def print(output)
if memory_diff > @threshold
@bad_actions[@pids[pid][:action]] ||= 0
@bad_actions[@pids[pid][:action]] = @bad_actions[@pids[pid][:action]] + 1
date = /^(\w+ \d{2} \d{2}:\d{2}:\d{2})/.match(line).captures[0]
date = HODEL_LOG_FORMAT_REGEX.match(line).captures[0]
@bad_requests.push(OinkedMemoryRequest.new(@pids[pid][:action], date, @pids[pid][:buffer], memory_diff))
if @format == :verbose
@pids[pid][:buffer].each { |b| output.puts b }
Expand Down

0 comments on commit 0a6edeb

Please sign in to comment.