Class: ScoutApm::SlowTransaction
- Inherits:
-
Object
- Object
- ScoutApm::SlowTransaction
- Includes:
- BucketNameSplitter
- Defined in:
- lib/scout_apm/slow_transaction.rb
Instance Attribute Summary collapse
-
#allocation_metrics ⇒ Object
readonly
Returns the value of attribute allocation_metrics.
-
#allocations ⇒ Object
readonly
Returns the value of attribute allocations.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#git_sha ⇒ Object
hack - we need to reset these server side.
-
#hostname ⇒ Object
hack - we need to reset these server side.
-
#mem_delta ⇒ Object
readonly
Returns the value of attribute mem_delta.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#metric_name ⇒ Object
readonly
Returns the value of attribute metric_name.
-
#metrics ⇒ Object
readonly
Returns the value of attribute metrics.
-
#prof ⇒ Object
readonly
Returns the value of attribute prof.
-
#seconds_since_startup ⇒ Object
hack - we need to reset these server side.
-
#span_trace ⇒ Object
readonly
Returns the value of attribute span_trace.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#total_call_time ⇒ Object
readonly
Returns the value of attribute total_call_time.
-
#truncated_metrics ⇒ Object
readonly
True/False that says if we had to truncate the metrics of this trace.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #as_json ⇒ Object
-
#call ⇒ Object
Scorable interface.
-
#clear_metrics! ⇒ Object
Used to remove metrics when the payload will be too large.
- #context_hash ⇒ Object
- #has_metrics? ⇒ Boolean
-
#initialize(agent_context, uri, metric_name, total_call_time, metrics, allocation_metrics, context, time, raw_stackprof, mem_delta, allocations, score, truncated_metrics, span_trace) ⇒ SlowTransaction
constructor
A new instance of SlowTransaction.
- #name ⇒ Object
- #score ⇒ Object
Methods included from BucketNameSplitter
#bucket_name, #bucket_type, #key
Constructor Details
#initialize(agent_context, uri, metric_name, total_call_time, metrics, allocation_metrics, context, time, raw_stackprof, mem_delta, allocations, score, truncated_metrics, span_trace) ⇒ SlowTransaction
Returns a new instance of SlowTransaction.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# 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 |
Instance Attribute Details
#allocation_metrics ⇒ Object (readonly)
Returns the value of attribute allocation_metrics.
8 9 10 |
# File 'lib/scout_apm/slow_transaction.rb', line 8 def allocation_metrics @allocation_metrics end |
#allocations ⇒ Object (readonly)
Returns the value of attribute allocations.
15 16 17 |
# File 'lib/scout_apm/slow_transaction.rb', line 15 def allocations @allocations end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
11 12 13 |
# File 'lib/scout_apm/slow_transaction.rb', line 11 def context @context end |
#git_sha ⇒ Object
hack - we need to reset these server side.
19 20 21 |
# File 'lib/scout_apm/slow_transaction.rb', line 19 def git_sha @git_sha end |
#hostname ⇒ Object
hack - we need to reset these server side.
17 18 19 |
# File 'lib/scout_apm/slow_transaction.rb', line 17 def hostname @hostname end |
#mem_delta ⇒ Object (readonly)
Returns the value of attribute mem_delta.
14 15 16 |
# File 'lib/scout_apm/slow_transaction.rb', line 14 def mem_delta @mem_delta end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
9 10 11 |
# File 'lib/scout_apm/slow_transaction.rb', line 9 def @meta end |
#metric_name ⇒ Object (readonly)
Returns the value of attribute metric_name.
5 6 7 |
# File 'lib/scout_apm/slow_transaction.rb', line 5 def metric_name @metric_name end |
#metrics ⇒ Object (readonly)
Returns the value of attribute metrics.
7 8 9 |
# File 'lib/scout_apm/slow_transaction.rb', line 7 def metrics @metrics end |
#prof ⇒ Object (readonly)
Returns the value of attribute prof.
13 14 15 |
# File 'lib/scout_apm/slow_transaction.rb', line 13 def prof @prof end |
#seconds_since_startup ⇒ Object
hack - we need to reset these server side.
18 19 20 |
# File 'lib/scout_apm/slow_transaction.rb', line 18 def seconds_since_startup @seconds_since_startup end |
#span_trace ⇒ Object (readonly)
Returns the value of attribute span_trace.
16 17 18 |
# File 'lib/scout_apm/slow_transaction.rb', line 16 def span_trace @span_trace end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
12 13 14 |
# File 'lib/scout_apm/slow_transaction.rb', line 12 def time @time end |
#total_call_time ⇒ Object (readonly)
Returns the value of attribute total_call_time.
6 7 8 |
# File 'lib/scout_apm/slow_transaction.rb', line 6 def total_call_time @total_call_time end |
#truncated_metrics ⇒ Object (readonly)
True/False that says if we had to truncate the metrics of this trace
21 22 23 |
# File 'lib/scout_apm/slow_transaction.rb', line 21 def truncated_metrics @truncated_metrics end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
10 11 12 |
# File 'lib/scout_apm/slow_transaction.rb', line 10 def uri @uri end |
Instance Method Details
#as_json ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# 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 ⇒ Object
Scorable interface
Needed so we can merge ScoredItemSet instances
79 80 81 |
# File 'lib/scout_apm/slow_transaction.rb', line 79 def call self end |
#clear_metrics! ⇒ Object
Used to remove metrics when the payload will be too large.
45 46 47 48 |
# File 'lib/scout_apm/slow_transaction.rb', line 45 def clear_metrics! @metrics = nil self end |
#context_hash ⇒ Object
71 72 73 |
# File 'lib/scout_apm/slow_transaction.rb', line 71 def context_hash context.to_hash end |
#has_metrics? ⇒ Boolean
50 51 52 |
# File 'lib/scout_apm/slow_transaction.rb', line 50 def has_metrics? metrics and metrics.any? end |
#name ⇒ Object
83 84 85 |
# File 'lib/scout_apm/slow_transaction.rb', line 83 def name metric_name end |
#score ⇒ Object
87 88 89 |
# File 'lib/scout_apm/slow_transaction.rb', line 87 def score @score end |