public long getMaxLagForPartition(PartitionId partitionId) {
    Map<DataNodeId, Long> perDataNodeLag = partitionLags.get(partitionId);
    if (perDataNodeLag == null || perDataNodeLag.isEmpty()) {
      return -1;
    }
    Map.Entry<DataNodeId, Long> maxEntry = perDataNodeLag.entrySet().stream().max(Map.Entry.comparingByValue()).get();
    return maxEntry.getValue();
  }
Get a partition's maximum lag between local and its {@link RemoteReplicaInfo}s.
@param partitionId the partition to check
ambry-replication/src/main/java/com/github/ambry/replication/ReplicationMetrics.java