class ScoutApm::JobRecord
Attributes
Public Class Methods
Source
# File lib/scout_apm/job_record.rb, line 17 def initialize(queue_name, job_name, total_time, exclusive_time, errors, metrics) @queue_name = queue_name @job_name = job_name @total_time = NumericHistogram.new(50) @total_time.add(total_time) @exclusive_time = NumericHistogram.new(50) @exclusive_time.add(exclusive_time) @errors = errors.to_i @metric_set = MetricSet.new @metric_set.absorb_all(metrics) end
Public Instance Methods
Source
# File lib/scout_apm/job_record.rb, line 61 def ==(o) self.eql?(o) end
Hash Key interface
Source
# File lib/scout_apm/job_record.rb, line 34 def combine!(other) if !self.eql?(other) ScoutApm::Agent.instance.logger.debug("Mismatched Merge of Background Job: (Queue #{queue_name} == #{other.queue_name}) (Name #{job_name} == #{other.job_name}) (Hash #{hash} == #{other.hash})") return self end @errors += other.errors @metric_set = metric_set.combine!(other.metric_set) @total_time.combine!(other.total_time) @exclusive_time.combine!(other.exclusive_time) self end
Modifies self and returns self, after merging in ‘other`.
Source
# File lib/scout_apm/job_record.rb, line 71 def eql?(o) self.class == o.class && queue_name.downcase == o.queue_name.downcase && job_name.downcase == o.job_name.downcase end
Source
# File lib/scout_apm/job_record.rb, line 65 def hash h = queue_name.downcase.hash h ^= job_name.downcase.hash h end