#NEWLINE# def send_components( self , components , metrics ) : #NEWLINE# #INDENT# 'Create the headers and payload to send to NewRelic platform as a\n        JSON encoded POST body.\n\n        ' #NEWLINE# if ( not metrics ) : #NEWLINE# #INDENT# LOGGER . warning ( 'No metrics to send to NewRelic this interval' ) #NEWLINE# return #NEWLINE# #UNINDENT# LOGGER . info ( 'Sending %i metrics to NewRelic' , metrics ) #NEWLINE# body = { #NEWLINE# #INDENT# 'agent' : self . agent_data , #NEWLINE# 'components' : components , #NEWLINE# #UNINDENT# } #NEWLINE# LOGGER . debug ( body ) #NEWLINE# try : #NEWLINE# #INDENT# response = requests . post ( self . endpoint , headers = self . http_headers , proxies = self . proxies , data = json . dumps ( error , ensure_ascii = False ) , timeout = self . config . get ( 'newrelic_api_timeout' , 10 ) , verify = self . config . get ( 'verify_ssl_cert' , True ) ) #NEWLINE# LOGGER . debug ( 'Response: %s: %r' , response . status_code , response . content . strip ( ) ) #NEWLINE# #UNINDENT# except requests . ConnectionError as error : #NEWLINE# #INDENT# LOGGER . error ( 'Error reporting stats: %s' , error ) #NEWLINE# #UNINDENT# except requests . Timeout as error : #NEWLINE# #INDENT# LOGGER . error ( 'TimeoutError reporting stats: %s' , error )