You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pegasus.apache.org by GitBox <gi...@apache.org> on 2020/09/09 09:04:30 UTC

[GitHub] [incubator-pegasus] neverchanje commented on a change in pull request #597: refactor(collector): sort out the structure of partition hotspot detection

neverchanje commented on a change in pull request #597:
URL: https://github.com/apache/incubator-pegasus/pull/597#discussion_r485455252



##########
File path: src/server/hotspot_partition_calculator.h
##########
@@ -0,0 +1,57 @@
+// 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.
+
+#pragma once
+
+#include "hotspot_partition_data.h"
+#include <gtest/gtest_prod.h>
+#include <dsn/perf_counter/perf_counter.h>
+#include <dsn/utility/flags.h>
+
+namespace pegasus {
+namespace server {
+
+// hotspot_partition_calculator is used to find the hotspot in Pegasus
+class hotspot_partition_calculator
+{
+public:
+    hotspot_partition_calculator(const std::string &app_name, const int partition_count)
+        : _app_name(app_name), _hot_points(partition_count)
+    {
+        init_perf_counter(partition_count);
+    }
+    // aggregate related data of hotspot detection
+    void data_aggregate(const std::vector<row_data> &partitions);
+    // analyse the saved data to find hotspot partition
+    void data_analyse();
+    void init_perf_counter(const int perf_counter_count);

Review comment:
       do not pass value-typed constant.
   ```suggestion
       void init_perf_counter(int perf_counter_count);
   ```
   BTW, is `init_perf_counter` used in somewhere else? If not, declare it private.

##########
File path: src/server/hotspot_partition_calculator.h
##########
@@ -0,0 +1,57 @@
+// 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.
+
+#pragma once
+
+#include "hotspot_partition_data.h"
+#include <gtest/gtest_prod.h>
+#include <dsn/perf_counter/perf_counter.h>
+#include <dsn/utility/flags.h>
+
+namespace pegasus {
+namespace server {
+
+// hotspot_partition_calculator is used to find the hotspot in Pegasus
+class hotspot_partition_calculator
+{
+public:
+    hotspot_partition_calculator(const std::string &app_name, const int partition_count)

Review comment:
       ```suggestion
       hotspot_partition_calculator(const std::string &app_name, int partition_count)
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pegasus.apache.org
For additional commands, e-mail: dev-help@pegasus.apache.org