@Override
    public void operationComplete(ChannelFuture future) throws Exception {
      long writeFinishTime = System.currentTimeMillis();
      long channelWriteTime = writeFinishTime - responseWriteStartTime;
      if (future.isSuccess()) {
        completeRequest(!HttpUtil.isKeepAlive(finalResponseMetadata), true, true);
      } else {
        handleChannelWriteFailure(future.cause(), true);
      }
      long responseAfterWriteProcessingTime = System.currentTimeMillis() - writeFinishTime;
      nettyMetrics.channelWriteTimeInMs.update(channelWriteTime);
      nettyMetrics.responseMetadataAfterWriteProcessingTimeInMs.update(responseAfterWriteProcessingTime);
      if (request != null) {
        request.getMetricsTracker().nioMetricsTracker.addToResponseProcessingTime(
            channelWriteTime + responseAfterWriteProcessingTime);
      }
    }
Listener that will be attached to the write of an error response.
ambry-rest/src/main/java/com/github/ambry/rest/NettyResponseChannel.java