Record createRecord(String user, UserMetrics.ClientMetrics clientMetrics,
    long lastReportTimestamp, String server) {
    Record.Builder builder = Record.builder();
    String client = clientMetrics.getHostName();
    builder.put(Field.CLIENT, clientMetrics.getHostName());
    String mapKey = client + "$" + user + "$" + server;
    RequestCountPerSecond requestCountPerSecond = requestCountPerSecondMap.get(mapKey);
    if (requestCountPerSecond == null) {
      requestCountPerSecond = new RequestCountPerSecond();
      requestCountPerSecondMap.put(mapKey, requestCountPerSecond);
    }
    requestCountPerSecond.refresh(lastReportTimestamp, clientMetrics.getReadRequestsCount(),
      clientMetrics.getFilteredReadRequestsCount(), clientMetrics.getWriteRequestsCount());
    builder.put(Field.REQUEST_COUNT_PER_SECOND, requestCountPerSecond.getRequestCountPerSecond());
    builder.put(Field.READ_REQUEST_COUNT_PER_SECOND,
      requestCountPerSecond.getReadRequestCountPerSecond());
    builder.put(Field.WRITE_REQUEST_COUNT_PER_SECOND,
      requestCountPerSecond.getWriteRequestCountPerSecond());
    builder.put(Field.FILTERED_READ_REQUEST_COUNT_PER_SECOND,
      requestCountPerSecond.getFilteredReadRequestCountPerSecond());
    builder.put(Field.USER, user);
    return builder.build();
  }
Aggregate the records and count the unique values for the given distinctField
@param records               records to be processed
@param groupBy               Field on which group by needs to be done
@param distinctField         Field whose unique values needs to be counted
@param uniqueCountAssignedTo a target field to which the unique count is assigned to
@return aggregated records
hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/mode/ClientModeStrategy.java