private void onErrorResponse(ReplicaId replicaId, TrackedRequestFinalState putRequestFinalState,
        boolean updateDataNodeMetrics) {
      // For Put, final state could be TIMED_OUT, REQUEST_DISABLED and FAILURE
      operationTracker.onResponse(replicaId, putRequestFinalState);
      routerMetrics.routerRequestErrorCount.inc();
      if (updateDataNodeMetrics) {
        routerMetrics.getDataNodeBasedMetrics(replicaId.getDataNodeId()).putRequestErrorCount.inc();
      }
    }
Perform the necessary actions when a request to a replica fails.
@param replicaId the {@link ReplicaId} associated with the failed response.
@param putRequestFinalState the {@link RouterErrorCode} associated with failed response.
@param updateDataNodeMetrics {@code true} if data node metrics should be updated. {@code false} otherwise.
ambry-router/src/main/java/com/github/ambry/router/PutOperation.java