lib/ting_yun/agent/transaction.rb in tingyun_rpm-1.2.0 vs lib/ting_yun/agent/transaction.rb in tingyun_rpm-1.3.0
- old
+ new
@@ -24,18 +24,21 @@
SUBTRANSACTION_PREFIX = 'Nested/'.freeze
CONTROLLER_PREFIX = 'WebAction/'.freeze
+ BACKGROUND_PREFIX = 'BackgroundAction/'.freeze
RAKE_TRANSACTION_PREFIX = 'BackgroundAction/Rake'.freeze
TASK_PREFIX = 'OtherTransaction/Background/'.freeze
RACK_PREFIX = 'Rack/'.freeze
- SINATRA_PREFIX = 'Sinatra/'.freeze
+ SINATRA_PREFIX = 'WebAction/Sinatra/'.freeze
MIDDLEWARE_PREFIX = 'Middleware/Rack/'.freeze
- GRAPE_PREFIX = 'Grape/'.freeze
- RAKE_PREFIX = 'Rake'.freeze
+ GRAPE_PREFIX = 'WebAction/Grape/'.freeze
+ RAKE_PREFIX = 'WebAction/Rake'.freeze
+ CABLE_PREFIX = 'WebAction/ActionCable'.freeze
+
EMPTY_SUMMARY_METRICS = [].freeze
MIDDLEWARE_SUMMARY_METRICS = ['Middleware/all'.freeze].freeze
TRACE_OPTIONS_SCOPED = {:metric => true, :scoped_metric => true}.freeze
TRACE_OPTIONS_UNSCOPED = {:metric => true, :scoped_metric => false}.freeze
@@ -55,11 +58,12 @@
:request_attributes,
:frame_stack,
:guid,
:category,
:default_name,
- :start_time
+ :start_time,
+ :base_quantile_hash
def initialize(category, client_transaction_id, options)
@start_time = Time.now
@@ -73,10 +77,11 @@
@category = category
@guid = client_transaction_id || generate_guid
@frame_stack = []
@frozen_name = nil
+ @base_quantile_hash = {}
@default_name = TingYun::Helper.correctly_encoded(options[:transaction_name])
if request = options[:request]
@request_attributes = TingYun::Agent::Transaction::RequestAttributes.new request
else
@@ -106,11 +111,11 @@
end
- def stop(state, end_time, outermost_frame)
+ def stop(state, end_time, outermost_frame, summary_metrics = [])
freeze_name_and_execute
if @has_children
name = Transaction.nested_transaction_name(outermost_frame.name)
@@ -123,12 +128,12 @@
if name.start_with?(MIDDLEWARE_PREFIX)
summary_metrics_with_exclusive_time = MIDDLEWARE_SUMMARY_METRICS
else
summary_metrics_with_exclusive_time = EMPTY_SUMMARY_METRICS
end
+ summary_metrics_with_exclusive_time = summary_metrics unless summary_metrics.empty?
-
TingYun::Agent::MethodTracerHelpers.trace_execution_scoped_footer(
state,
start_time.to_f,
name,
summary_metrics_with_exclusive_time,
@@ -147,15 +152,16 @@
TingYun::Agent.instance.transaction_sampler.on_finishing_transaction(state, self, end_time)
TingYun::Agent.instance.sql_sampler.on_finishing_transaction(state, @frozen_name)
- record_summary_metrics(outermost_node_name, end_time)
+ record_summary_metrics(state, outermost_node_name, end_time)
@apdex.record_apdex(@frozen_name, end_time, @exceptions.had_error?)
@exceptions.record_exceptions(@attributes)
TingYun::Agent.instance.stats_engine.merge_transaction_metrics!(@metrics, best_name)
+ TingYun::Agent.instance.stats_engine.record_base_quantile(@base_quantile_hash) if @exceptions.exceptions.empty?
end
end
end
end