Class: ScoutApm::SlowJobRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/scout_apm/slow_job_record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent_context, queue_name, job_name, time, total_time, exclusive_time, context, metrics, allocation_metrics, mem_delta, allocations, score, truncated_metrics, span_trace) ⇒ SlowJobRecord

Returns a new instance of SlowJobRecord.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/scout_apm/slow_job_record.rb', line 28

def initialize(agent_context, queue_name, job_name, time, total_time, exclusive_time, context, metrics, allocation_metrics, mem_delta, allocations, score, truncated_metrics, span_trace)
  @queue_name = queue_name
  @job_name = job_name
  @time = time
  @total_time = total_time
  @exclusive_time = exclusive_time
  @context = context
  @metrics = metrics
  @allocation_metrics = allocation_metrics
  @mem_delta = mem_delta
  @allocations = allocations
  @seconds_since_startup = (Time.now - agent_context.process_start_time)
  @hostname = agent_context.environment.hostname
  @git_sha = agent_context.environment.git_revision.sha
  @score = score
  @truncated_metrics = truncated_metrics

  @span_trace = span_trace

  agent_context.logger.debug { "Slow Job [#{metric_name}] - Call Time: #{total_call_time} Mem Delta: #{mem_delta}"}
end

Instance Attribute Details

#allocation_metricsObject (readonly)

Returns the value of attribute allocation_metrics.



17
18
19
# File 'lib/scout_apm/slow_job_record.rb', line 17

def allocation_metrics
  @allocation_metrics
end

#allocationsObject (readonly)

Returns the value of attribute allocations.



19
20
21
# File 'lib/scout_apm/slow_job_record.rb', line 19

def allocations
  @allocations
end

#contextObject (readonly)

What else interesting did we learn?



10
11
12
# File 'lib/scout_apm/slow_job_record.rb', line 10

def context
  @context
end

#exclusive_timeObject (readonly)

Returns the value of attribute exclusive_time.



13
14
15
# File 'lib/scout_apm/slow_job_record.rb', line 13

def exclusive_time
  @exclusive_time
end

#git_shaObject (readonly)

Returns the value of attribute git_sha.



23
24
25
# File 'lib/scout_apm/slow_job_record.rb', line 23

def git_sha
  @git_sha
end

#hostnameObject (readonly)

Returns the value of attribute hostname.



20
21
22
# File 'lib/scout_apm/slow_job_record.rb', line 20

def hostname
  @hostname
end

#job_nameObject (readonly)

Returns the value of attribute job_name.



4
5
6
# File 'lib/scout_apm/slow_job_record.rb', line 4

def job_name
  @job_name
end

#mem_deltaObject (readonly)

Returns the value of attribute mem_delta.



18
19
20
# File 'lib/scout_apm/slow_job_record.rb', line 18

def mem_delta
  @mem_delta
end

#metricsObject (readonly)

Returns the value of attribute metrics.



16
17
18
# File 'lib/scout_apm/slow_job_record.rb', line 16

def metrics
  @metrics
end

#queue_nameObject (readonly)

Returns the value of attribute queue_name.



3
4
5
# File 'lib/scout_apm/slow_job_record.rb', line 3

def queue_name
  @queue_name
end

#scoreObject (readonly)

Returns the value of attribute score.



22
23
24
# File 'lib/scout_apm/slow_job_record.rb', line 22

def score
  @score
end

#seconds_since_startupObject (readonly)

Returns the value of attribute seconds_since_startup.



21
22
23
# File 'lib/scout_apm/slow_job_record.rb', line 21

def seconds_since_startup
  @seconds_since_startup
end

#span_traceObject (readonly)

Returns the value of attribute span_trace.



26
27
28
# File 'lib/scout_apm/slow_job_record.rb', line 26

def span_trace
  @span_trace
end

#timeObject (readonly)

When did this job occur



7
8
9
# File 'lib/scout_apm/slow_job_record.rb', line 7

def time
  @time
end

#total_timeObject (readonly) Also known as: total_call_time

Returns the value of attribute total_time.



12
13
14
# File 'lib/scout_apm/slow_job_record.rb', line 12

def total_time
  @total_time
end

#truncated_metricsObject (readonly)

Returns the value of attribute truncated_metrics.



24
25
26
# File 'lib/scout_apm/slow_job_record.rb', line 24

def truncated_metrics
  @truncated_metrics
end

Instance Method Details

#callObject

Scorable interface

Needed so we can merge ScoredItemSet instances



58
59
60
# File 'lib/scout_apm/slow_job_record.rb', line 58

def call
  self
end

#metric_nameObject



50
51
52
# File 'lib/scout_apm/slow_job_record.rb', line 50

def metric_name
  "Job/#{queue_name}/#{job_name}"
end

#nameObject



62
63
64
# File 'lib/scout_apm/slow_job_record.rb', line 62

def name
  metric_name
end