Method: NewRelic::Agent::Transaction::ExternalRequestSegment#add_request_headers
- Defined in:
- lib/new_relic/agent/transaction/external_request_segment.rb
#add_request_headers(request) ⇒ Object
This method adds New Relic request headers to a given request made to an external API and checks to see if a host header is used for the request. If a host header is used, it updates the segment name to match the host header.
object (must belong to a subclass of NewRelic::Agent::HTTPClients::AbstractRequest)
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/new_relic/agent/transaction/external_request_segment.rb', line 64 def add_request_headers(request) process_host_header(request) synthetics_header = transaction&.raw_synthetics_header synthetics_info_header = transaction&.raw_synthetics_info_header insert_synthetics_header(request, synthetics_header, synthetics_info_header) if synthetics_header return unless record_metrics? transaction.distributed_tracer.insert_headers(request) rescue => e NewRelic::Agent.logger.error('Error in add_request_headers', e) end |