class ScoutApm::SlowTransaction

Attributes

allocation_metrics[R]
allocations[R]
context[R]
git_sha[RW]
hostname[RW]
mem_delta[R]
meta[R]
metric_name[R]
metrics[R]
prof[R]
seconds_since_startup[RW]
span_trace[R]
time[R]
total_call_time[R]
truncated_metrics[R]
uri[R]

Public Class Methods

new(agent_context, uri, metric_name, total_call_time, metrics, allocation_metrics, context, time, raw_stackprof, mem_delta, allocations, score, truncated_metrics, span_trace) click to toggle source
# File lib/scout_apm/slow_transaction.rb, line 23
def initialize(agent_context, uri, metric_name, total_call_time, metrics, allocation_metrics, context, time, raw_stackprof, mem_delta, allocations, score, truncated_metrics, span_trace)
  @uri = uri
  @metric_name = metric_name
  @total_call_time = total_call_time
  @metrics = metrics
  @allocation_metrics = allocation_metrics
  @context = context
  @time = time || Time.now
  @prof = []
  @mem_delta = mem_delta
  @allocations = allocations
  @seconds_since_startup = (Time.now - agent_context.process_start_time)
  @hostname = agent_context.environment.hostname
  @score = score
  @git_sha = agent_context.environment.git_revision.sha
  @truncated_metrics = truncated_metrics
  @span_trace = span_trace

  agent_context.logger.debug { "Slow Request [#{uri}] - Call Time: #{total_call_time} Mem Delta: #{mem_delta} Score: #{score}"}
end

Public Instance Methods

as_json() click to toggle source
# File lib/scout_apm/slow_transaction.rb, line 54
def as_json
  json_attributes = [:key,
                     :time,
                     :total_call_time,
                     :uri,
                     [:context, :context_hash],
                     :score,
                     :prof,
                     :mem_delta,
                     :allocations,
                     :seconds_since_startup,
                     :hostname,
                     :git_sha,
                     :truncated_metrics]
  ScoutApm::AttributeArranger.call(self, json_attributes)
end
call() click to toggle source

Scorable interface

Needed so we can merge ScoredItemSet instances

# File lib/scout_apm/slow_transaction.rb, line 79
def call
  self
end
clear_metrics!() click to toggle source

Used to remove metrics when the payload will be too large.

# File lib/scout_apm/slow_transaction.rb, line 45
def clear_metrics!
  @metrics = nil
  self
end
context_hash() click to toggle source
# File lib/scout_apm/slow_transaction.rb, line 71
def context_hash
  context.to_hash
end
has_metrics?() click to toggle source
# File lib/scout_apm/slow_transaction.rb, line 50
def has_metrics?
  metrics and metrics.any?
end
name() click to toggle source
# File lib/scout_apm/slow_transaction.rb, line 83
def name
  metric_name
end
score() click to toggle source
# File lib/scout_apm/slow_transaction.rb, line 87
def score
  @score
end