class ScoutApm::Extensions::TransactionCallbackPayload
A TransactionCallbackPayload
is passed to each Transaction
callback’s call
method. It encapsulates the data about a specific transaction.
Attributes
A Hash that stores the output of each layer converter by name. See the naming conventions in TrackedRequest
.
Public Class Methods
Source
# File lib/scout_apm/extensions/transaction_callback_payload.rb, line 9 def initialize(agent_context,converter_results,context,scope_layer) @agent_context = agent_context @converter_results = converter_results @context = context @scope_layer = scope_layer end
Public Instance Methods
Source
# File lib/scout_apm/extensions/transaction_callback_payload.rb, line 44 def app_name @agent_context.config.value('name') end
Source
# File lib/scout_apm/extensions/transaction_callback_payload.rb, line 17 def context @context.to_flat_hash end
A flat hash of the context associated w/this transaction (ie user ip and another other data added to context).
Source
# File lib/scout_apm/extensions/transaction_callback_payload.rb, line 22 def duration_ms @scope_layer.total_call_time*1000 # ms end
The total duration of the transaction
Source
# File lib/scout_apm/extensions/transaction_callback_payload.rb, line 49 def error? converter_results[:errors] && converter_results[:errors].any? end
Returns true
if the transaction raised an exception.
Source
# File lib/scout_apm/extensions/transaction_callback_payload.rb, line 40 def hostname @agent_context.environment.hostname end
Source
# File lib/scout_apm/extensions/transaction_callback_payload.rb, line 27 def queue_time_ms # Controller logic if converter_results[:queue_time] && converter_results[:queue_time].any? converter_results[:queue_time].values.first.total_call_time*1000 # ms # Job logic elsif converter_results[:job] stat = converter_results[:job].metric_set.metrics[ScoutApm::MetricMeta.new("Latency/all", :scope => transaction_name)] stat ? stat.total_call_time*1000 : nil else nil end end
The time in queue of the transaction in ms. If not present, nil
is returned as this is unknown.
Source
# File lib/scout_apm/extensions/transaction_callback_payload.rb, line 57 def transaction_name @scope_layer.legacy_metric_name end
Source
# File lib/scout_apm/extensions/transaction_callback_payload.rb, line 62 def transaction_type_slug case transation_type when 'Controller' 'web' when 'Job' 'job' else 'transaction' end end
Web/Job are more language-agnostic names for controller/job. For example, Python Django does not have controllers.
Source
# File lib/scout_apm/extensions/transaction_callback_payload.rb, line 53 def transation_type @scope_layer.type end