# encoding: utf-8 module OneApm class Transaction module TransactionFinishAppend def append_cat_info(state, duration, payload) return unless include_guid?(state, duration) payload[:guid] = guid return unless state.is_cross_app? trip_id = cat_trip_id(state) path_hash = cat_path_hash(state) referring_path_hash = cat_referring_path_hash(state) payload[:cat_trip_id] = trip_id if trip_id payload[:cat_referring_path_hash] = referring_path_hash if referring_path_hash if path_hash payload[:cat_path_hash] = path_hash alternate_path_hashes = cat_path_hashes - [path_hash] unless alternate_path_hashes.empty? payload[:cat_alternate_path_hashes] = alternate_path_hashes end end end def append_apdex_perf_zone(duration, payload) return unless recording_web_transaction? bucket = apdex_bucket(duration) bucket_str = case bucket when :apdex_s then Transaction::OA_APDEX_S when :apdex_t then Transaction::OA_APDEX_T when :apdex_f then Transaction::OA_APDEX_F else nil end payload[:apdex_perf_zone] = bucket_str if bucket_str end def append_referring_transaction_guid_to(state, payload) referring_guid = OneApm::Manager.agent.cross_app_monitor.client_referring_transaction_guid(state) if referring_guid payload[:referring_transaction_guid] = referring_guid end end def append_http_response_code(payload) payload[:http_response_code] = http_response_code if http_response_code end def append_synthetics_to(state, payload) return unless is_synthetics_request? payload[:synthetics_resource_id] = synthetics_resource_id payload[:synthetics_job_id] = synthetics_job_id payload[:synthetics_monitor_id] = synthetics_monitor_id end def append_metric_ids_to(payload) payload[:metric_ids] = agent.service.metric_id_cache if agent.service end def include_guid?(state, duration) state.is_cross_app? || is_synthetics_request? end end end end