def add_request_headers request
process_host_header request
return unless record_metrics? && CrossAppTracing.cross_app_enabled?
transaction_state.is_cross_app_caller = true
txn_guid = transaction_state.request_guid
trip_id = transaction && transaction.cat_trip_id(transaction_state)
path_hash = transaction && transaction.cat_path_hash(transaction_state)
synthetics_header = transaction && transaction.raw_synthetics_header
CrossAppTracing.insert_request_headers request, txn_guid, trip_id, path_hash, synthetics_header
rescue => e
NewRelic::Agent.logger.error "Error in add_request_headers", e
end