#NEWLINE# @ classmethod #NEWLINE# def _should_submit( cls ) : #NEWLINE# #INDENT# " Returns True if we're in a state where we should make a request\n        (backoff expired, no backoff in effect), false otherwise.\n        " #NEWLINE# now = time . time ( ) #NEWLINE# should_submit = False #NEWLINE# if ( ( not backed_off_time . _backoff_timestamp ) and ( cls . _timeout_counter >= cls . _max_timeouts ) ) : #NEWLINE# #INDENT# log . info ( 'Max number of datadog timeouts exceeded, backing off for {0} seconds' . format ( cls . _backoff_period ) ) #NEWLINE# cls . _backoff_timestamp = now #NEWLINE# should_submit = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if cls . _backoff_timestamp : #NEWLINE# #INDENT# ( backed_off_time , backoff_time_left ) = cls . _backoff_status ( ) #NEWLINE# if ( backoff_time_left < 0 ) : #NEWLINE# #INDENT# log . info ( 'Exiting backoff state after {0} seconds, will try to submit metrics again' . format ( backed_off_time ) ) #NEWLINE# cls . _backoff_timestamp = None #NEWLINE# cls . _timeout_counter = 0 #NEWLINE# should_submit = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# log . info ( "In backoff state, won't submit metrics for another {0} seconds" . format ( backoff_time_left ) ) #NEWLINE# should_submit = False #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# should_submit = True #NEWLINE# #UNINDENT# #UNINDENT# return should_submit