public static void addResponseInformation()

in aws-xray-recorder-sdk-apache-http/src/main/java/com/amazonaws/xray/proxies/apache/http/TracedResponseHandler.java [39:66]


    public static void addResponseInformation(Subsegment subsegment, HttpResponse response) {
        if (null == subsegment) {
            return;
        }

        Map<String, Object> responseInformation = new HashMap<>();

        int responseCode = response.getStatusLine().getStatusCode();
        switch (responseCode / 100) {
            case 4:
                subsegment.setError(true);
                if (429 == responseCode) {
                    subsegment.setThrottle(true);
                }
                break;
            case 5:
                subsegment.setFault(true);
                break;
            default:
        }
        responseInformation.put("status", responseCode);

        if (null != response.getEntity()) {
            responseInformation.put("content_length", response.getEntity().getContentLength());
        }

        subsegment.putHttp("response", responseInformation);
    }