Class: NewRelic::TransactionAnalysis::SegmentSummary
- Inherits:
-
Object
- Object
- NewRelic::TransactionAnalysis::SegmentSummary
- Defined in:
- lib/new_relic/transaction_analysis.rb
Overview
summarizes performance data for all calls to segments with the same metric_name
Instance Attribute Summary collapse
-
#call_count ⇒ Object
Returns the value of attribute call_count.
-
#exclusive_time ⇒ Object
Returns the value of attribute exclusive_time.
-
#metric_name ⇒ Object
Returns the value of attribute metric_name.
-
#total_time ⇒ Object
Returns the value of attribute total_time.
Instance Method Summary collapse
- #<<(segment) ⇒ Object
- #average_exclusive_time ⇒ Object
- #average_time ⇒ Object
- #developer_name ⇒ Object
- #exclusive_time_percentage ⇒ Object
-
#initialize(metric_name, sample) ⇒ SegmentSummary
constructor
A new instance of SegmentSummary.
- #total_time_percentage ⇒ Object
Constructor Details
#initialize(metric_name, sample) ⇒ SegmentSummary
Returns a new instance of SegmentSummary.
16 17 18 19 20 |
# File 'lib/new_relic/transaction_analysis.rb', line 16 def initialize(metric_name, sample) @metric_name = metric_name @total_time, @exclusive_time, @call_count = 0,0,0 @sample = sample end |
Instance Attribute Details
#call_count ⇒ Object
Returns the value of attribute call_count.
15 16 17 |
# File 'lib/new_relic/transaction_analysis.rb', line 15 def call_count @call_count end |
#exclusive_time ⇒ Object
Returns the value of attribute exclusive_time.
15 16 17 |
# File 'lib/new_relic/transaction_analysis.rb', line 15 def exclusive_time @exclusive_time end |
#metric_name ⇒ Object
Returns the value of attribute metric_name.
15 16 17 |
# File 'lib/new_relic/transaction_analysis.rb', line 15 def metric_name @metric_name end |
#total_time ⇒ Object
Returns the value of attribute total_time.
15 16 17 |
# File 'lib/new_relic/transaction_analysis.rb', line 15 def total_time @total_time end |
Instance Method Details
#<<(segment) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/new_relic/transaction_analysis.rb', line 22 def <<(segment) if metric_name != segment.metric_name raise ArgumentError, "Metric Name Mismatch: #{segment.metric_name} != #{metric_name}" end @total_time += segment.duration @exclusive_time += segment.exclusive_duration @call_count += 1 end |
#average_exclusive_time ⇒ Object
36 37 38 |
# File 'lib/new_relic/transaction_analysis.rb', line 36 def average_exclusive_time @exclusive_time / @call_count end |
#average_time ⇒ Object
32 33 34 |
# File 'lib/new_relic/transaction_analysis.rb', line 32 def average_time @total_time / @call_count end |
#developer_name ⇒ Object
50 51 52 53 |
# File 'lib/new_relic/transaction_analysis.rb', line 50 def developer_name return @metric_name if @metric_name == 'Remainder' NewRelic::MetricParser.parse(@metric_name).developer_name end |
#exclusive_time_percentage ⇒ Object
40 41 42 43 |
# File 'lib/new_relic/transaction_analysis.rb', line 40 def exclusive_time_percentage return 0 unless @exclusive_time && @sample.duration && @sample.duration > 0 @exclusive_time / @sample.duration end |
#total_time_percentage ⇒ Object
45 46 47 48 |
# File 'lib/new_relic/transaction_analysis.rb', line 45 def total_time_percentage return 0 unless @total_time && @sample.duration && @sample.duration > 0 @total_time / @sample.duration end |