brfrn169 commented on a change in pull request #722: HBASE-23065 [hbtop] Top-N 
heavy hitter user and client drill downs
URL: https://github.com/apache/hbase/pull/722#discussion_r336784148
 
 

 ##########
 File path: 
hbase-hbtop/src/main/java/org/apache/hadoop/hbase/hbtop/mode/ClientModeStrategy.java
 ##########
 @@ -0,0 +1,150 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.hbtop.mode;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.hadoop.hbase.ClusterMetrics;
+import org.apache.hadoop.hbase.ServerMetrics;
+import org.apache.hadoop.hbase.UserMetrics;
+import org.apache.hadoop.hbase.hbtop.Record;
+import org.apache.hadoop.hbase.hbtop.RecordFilter;
+import org.apache.hadoop.hbase.hbtop.field.Field;
+import org.apache.hadoop.hbase.hbtop.field.FieldInfo;
+import org.apache.hadoop.hbase.hbtop.field.FieldValue;
+import org.apache.hadoop.hbase.hbtop.field.FieldValueType;
+import org.apache.yetus.audience.InterfaceAudience;
+
+/**
+ * Implementation for {@link ModeStrategy} for client Mode.
+ */
+@InterfaceAudience.Private public final class ClientModeStrategy implements 
ModeStrategy {
+
+  private final List<FieldInfo> fieldInfos = Arrays
+      .asList(new FieldInfo(Field.CLIENT, 0, true), new 
FieldInfo(Field.USER_COUNT, 5, true),
+          new FieldInfo(Field.REQUEST_COUNT_PER_SECOND, 10, true),
+          new FieldInfo(Field.READ_REQUEST_COUNT_PER_SECOND, 10, true),
+          new FieldInfo(Field.WRITE_REQUEST_COUNT_PER_SECOND, 10, true));
+  private final Map<String, RequestCountPerSecond> requestCountPerSecondMap = 
new HashMap<>();
+
+  ClientModeStrategy() {
+  }
+
+  @Override public List<FieldInfo> getFieldInfos() {
+    return fieldInfos;
+  }
+
+  @Override public Field getDefaultSortField() {
+    return Field.REQUEST_COUNT_PER_SECOND;
+  }
+
+  @Override public List<Record> getRecords(ClusterMetrics clusterMetrics,
+      List<RecordFilter> pushDownFilters) {
+    List<Record> records = createRecords(clusterMetrics, pushDownFilters);
+    return aggregateRecordsAndAddDistinct(
+        ModeStrategyUtils.applyFilterAndGet(records, pushDownFilters), 
Field.CLIENT, Field.USER,
+        Field.USER_COUNT);
+  }
+
+  List<Record> createRecords(ClusterMetrics clusterMetrics, List<RecordFilter> 
pushDownFilters) {
 
 Review comment:
   It looks like we don't use `pushDownFilters` here. We can remove this 
argument.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to