Permalink
Browse files

Remove puts, fix some tests

  • Loading branch information...
1 parent f709e05 commit 941a4a5aef3be31b5d2c4e907220540923a2d75a @bkayser bkayser committed Jun 16, 2010
Showing with 6 additions and 11 deletions.
  1. +0 −6 lib/new_relic/agent/agent.rb
  2. +3 −3 lib/new_relic/stats.rb
  3. +3 −2 test/new_relic/stats_test.rb
@@ -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
View
@@ -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
@@ -1,3 +1,4 @@
+ENV['SKIP_RAILS'] = 'true'
require File.expand_path(File.join(File.dirname(__FILE__),'..', 'test_helper'))
##require "new_relic/stats"
@@ -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
@@ -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

0 comments on commit 941a4a5

Please sign in to comment.