(self)
Send a request to scrape metrics. Return the response or throw an exception.
Send a request to scrape metrics. Return the response or throw an exception.
Send a request to scrape metrics . Return the response or throw an exception .
def get_connection(self):
        """
        Send a request to scrape metrics. Return the response or throw an exception.
        """

        try:
            response = self.send_request()
        except Exception as e:
            self.submit_health_check(ServiceCheck.CRITICAL, message=str(e))
            raise
        else:
            try:
                response.raise_for_status()
            except Exception as e:
                self.submit_health_check(ServiceCheck.CRITICAL, message=str(e))
                response.close()
                raise
            else:
                self.submit_health_check(ServiceCheck.OK)

                # Never derive the encoding from the locale
                if response.encoding is None:
                    response.encoding = 'utf-8'

                self.submit_telemetry_endpoint_response_size(response)
                return response
def get_connection ( self ) : try : response = self . send_request ( ) except Exception as e : self . submit_health_check ( ServiceCheck . CRITICAL , message = str ( e ) ) raise else : try : response . raise_for_status ( ) except Exception as e : self . submit_health_check ( ServiceCheck . CRITICAL , message = str ( e ) ) response . close ( ) raise else : self . submit_health_check ( ServiceCheck . OK ) # Never derive the encoding from the locale if response . encoding is None : response . encoding = 'utf-8' self . submit_telemetry_endpoint_response_size ( response ) return response