private void logDurations() {
    long nowMs = System.currentTimeMillis();
    logMessage.append("bytes sent=").append(responseBytesSent).append(" ");
    structuredLogMessage.put("bytesSent", String.valueOf(responseBytesSent));
    logMessage.append("duration=").append(nowMs - requestArrivalTimeInMs).append("ms ");
    structuredLogMessage.put("duration", String.valueOf(nowMs - requestArrivalTimeInMs).concat("ms"));
    if (requestLastChunkArrivalTimeInMs != INIT_TIME) {
      logMessage.append("(chunked request receive=")
          .append(requestLastChunkArrivalTimeInMs - requestArrivalTimeInMs)
          .append("ms) ");
      structuredLogMessage.put("chunkedRequestReceive",
          String.valueOf(requestLastChunkArrivalTimeInMs - requestArrivalTimeInMs).concat("ms"));
    }
    if (responseFirstChunkStartTimeInMs != INIT_TIME) {
      logMessage.append("(chunked response send=").append(nowMs - responseFirstChunkStartTimeInMs).append("ms) ");
      structuredLogMessage.put("chunkedResponseSend",
          String.valueOf(nowMs - responseFirstChunkStartTimeInMs).concat("ms"));
    }
  }
Appends duration of operation to the log message. Also appends duration of receive or send phases of
operations if those phases used chunked encoding.
ambry-rest/src/main/java/com/github/ambry/rest/PublicAccessLogHandler.java