private void onErrorResponse(ReplicaId replicaId, RouterException exception, boolean updateDataNodeMetrics) {
      chunkOperationTracker.onResponse(replicaId,
          TrackedRequestFinalState.fromRouterErrorCodeToFinalState(exception.getErrorCode()));
      setChunkException(exception);
      routerMetrics.routerRequestErrorCount.inc();
      if (updateDataNodeMetrics) {
        routerMetrics.getDataNodeBasedMetrics(replicaId.getDataNodeId()).getRequestErrorCount.inc();
      }
    }
Perform the necessary actions when a request to a replica fails.
@param replicaId the {@link ReplicaId} associated with the failed response.
@param exception the {@link RouterException} associated with the 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/GetBlobOperation.java