class ScoutApm::ExternalServiceMetricStats
Constants
- DEFAULT_HISTOGRAM_SIZE
Attributes
call_count[R]
call_time[R]
domain_name[R]
histogram[R]
max_call_time[R]
min_call_time[R]
operation[R]
scope[R]
transaction_count[R]
Public Class Methods
new(domain_name, operation, scope, call_count, call_time)
click to toggle source
# File lib/scout_apm/external_service_metric_stats.rb, line 20 def initialize(domain_name, operation, scope, call_count, call_time) @domain_name = domain_name @operation = operation @call_count = call_count @call_time = call_time @min_call_time = call_time @max_call_time = call_time # This histogram is for call_time @histogram = NumericHistogram.new(DEFAULT_HISTOGRAM_SIZE) @histogram.add(call_time) @transaction_count = 0 @scope = scope end
Public Instance Methods
as_json()
click to toggle source
# File lib/scout_apm/external_service_metric_stats.rb, line 59 def as_json json_attributes = [ :domain_name, :operation, :scope, :transaction_count, :call_count, :histogram, :call_time, :max_call_time, :min_call_time, ] ScoutApm::AttributeArranger.call(self, json_attributes) end
combine!(other)
click to toggle source
Combine data from another ExternalServiceMetricStats
into self
. Modifies and returns self
# File lib/scout_apm/external_service_metric_stats.rb, line 45 def combine!(other) return self if other == self @transaction_count += other.transaction_count @call_count += other.call_count @call_time += other.call_time @min_call_time = other.min_call_time if @min_call_time.zero? or other.min_call_time < @min_call_time @max_call_time = other.max_call_time if other.max_call_time > @max_call_time @histogram.combine!(other.histogram) self end
increment_transaction_count!()
click to toggle source
Called by the Set on each ExternalServiceMetricStats
object that it holds, only once during the recording of a transaction.
Don't call elsewhere, and don't set to 1 in the initializer.
# File lib/scout_apm/external_service_metric_stats.rb, line 81 def increment_transaction_count! @transaction_count += 1 end
key()
click to toggle source
Merge data in this scope. Used in ExternalServiceMetricSet
# File lib/scout_apm/external_service_metric_stats.rb, line 40 def key @key ||= [domain_name, operation, scope] end