src/com/newrelic/metrics/publish/binding/Request.java
/**
     * Process response and log response as appropriate.
     * @param connection
     * @throws IOException
     */
Process response and log response as appropriate.
@param connection
@throws IOException
Process response and log response as appropriate . @param connection @throws IOException
private void processResponse(HttpURLConnection connection) throws IOException {
        int responseCode = connection.getResponseCode();
        if (isCollectorUnavailable(responseCode)) {
            logger.debug("Collector temporarily unavailable...continuing");
        }
        else {
            String responseBody = getServerResponse(responseCode, connection);
            if (isResponseEmpty(responseBody)) {
                logger.info("Failed server response: no response, with response code: ", responseCode);
            }
            else if (isRemotelyDisabled(responseCode, responseBody)) {
                logger.fatal("Agent has been disabled remotely by New Relic");
                System.err.println("SEVERE: Agent has been disabled remotely by New Relic");
                System.exit(EXIT_CODE);
            }
            else if (isResponseOk(responseCode, responseBody)) {
                logger.debug("Server response: ", responseCode, ", ", responseBody);
                delivered = true;
                Date deliveredAt = new Date();
                context.setAggregationStartedAt(deliveredAt);
                updateComponentTimestamps(deliveredAt);
            }
            else {
                logger.error("Failed server response: ", responseCode, ", ", responseBody);
            }
        }
    }
private void processResponse ( HttpURLConnection connection ) throws IOException { int responseCode = connection . getResponseCode ( ) ; if ( isCollectorUnavailable ( responseCode ) ) { logger . debug ( "Collector temporarily unavailable...continuing" ) ; } else { String responseBody = getServerResponse ( responseCode , connection ) ; if ( isResponseEmpty ( responseBody ) ) { logger . info ( "Failed server response: no response, with response code: " , responseCode ) ; } else if ( isRemotelyDisabled ( responseCode , responseBody ) ) { logger . fatal ( "Agent has been disabled remotely by New Relic" ) ; System . err . println ( "SEVERE: Agent has been disabled remotely by New Relic" ) ; System . exit ( EXIT_CODE ) ; } else if ( isResponseOk ( responseCode , responseBody ) ) { logger . debug ( "Server response: " , responseCode , ", " , responseBody ) ; delivered = true ; Date deliveredAt = new Date ( ) ; context . setAggregationStartedAt ( deliveredAt ) ; updateComponentTimestamps ( deliveredAt ) ; } else { logger . error ( "Failed server response: " , responseCode , ", " , responseBody ) ; } } }
Process response and log response as appropriate.
Process response and log response as appropriate .
// do not log 503 responses // read server response // Remote disabling by New Relic -- exit // update last successful timestamps // all other response codes will fail