Skip to content

Commit

Permalink
Remove puts, fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Kayser committed Jun 16, 2010
1 parent f709e05 commit 941a4a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
6 changes: 0 additions & 6 deletions lib/new_relic/agent/agent.rb
Expand Up @@ -69,13 +69,7 @@ def record_transaction(duration_seconds, options={})
raise "metric or uri arguments required" unless metric
metric_info = NewRelic::MetricParser.for_metric_named(metric)

puts "recording transaction - reponse_time=#{duration_seconds}"
puts "uri=#{options[:uri]}"
puts "metric=#{metric}"
puts "metric_info=#{metric_info}"

if metric_info.is_web_transaction?
puts "recording web transaction"
NewRelic::Agent::Instrumentation::MetricFrame.record_apdex(metric_info, duration_seconds, duration_seconds, is_error)
histogram.process(duration_seconds)
end
Expand Down
6 changes: 3 additions & 3 deletions lib/new_relic/stats.rb
Expand Up @@ -175,13 +175,13 @@ def exclusive_time_percentage
alias requests_per_minute calls_per_minute

def to_s
"<#{Time.at(begin_time)}, #{Time.at(end_time)}> count:#{call_count} total:#{total_call_time}"
summary
end

# Summary string to facilitate testing
def summary
format = "%m/%d %I:%M%p"
"[#{Time.at(begin_time).strftime(format)}, #{'%2.3fs' % duration}; #{'%4i' % call_count} calls #{'%4i' % to_ms(average_call_time)} ms]"
format = "%m/%d/%y %I:%M%p"
"[#{Time.at(begin_time).utc.strftime(format)} UTC, #{'%2.3fs' % duration}; #{'%2i' % call_count} calls #{'%4i' % to_ms(average_call_time)} ms]"
end

# round all of the values to n decimal points
Expand Down
5 changes: 3 additions & 2 deletions test/new_relic/stats_test.rb
@@ -1,3 +1,4 @@
ENV['SKIP_RAILS'] = 'true'
require File.expand_path(File.join(File.dirname(__FILE__),'..', 'test_helper'))
##require "new_relic/stats"

Expand Down Expand Up @@ -28,7 +29,7 @@ def test_simple
def test_to_s
s1 = NewRelic::MethodTraceStats.new
s1.trace_call 10
assert_equal(s1.to_s, "Begin=0.0, Duration=0.0 s, Count=1, Total=10000, Total Exclusive=10000, Avg=10000, Min=10000, Max=10000, StdDev=0")
assert_equal("[01/01/70 12:00AM UTC, 0.000s; 1 calls 10000 ms]", s1.to_s)
end

def test_time_str
Expand Down Expand Up @@ -60,7 +61,7 @@ def test_fraction_of2
def test_multiply_by
s1 = NewRelic::MethodTraceStats.new
s1.trace_call 10
assert_equal(s1.multiply_by(10).to_s, "Begin=0.0, Duration=0.0 s, Count=10, Total=100000, Total Exclusive=10000, Avg=10000, Min=10000, Max=10000, StdDev=0")
assert_equal("[01/01/70 12:00AM UTC, 0.000s; 10 calls 10000 ms]", s1.multiply_by(10).to_s)
end

def test_get_apdex
Expand Down

0 comments on commit 941a4a5

Please sign in to comment.