acelyc111 commented on code in PR #1455:
URL: 
https://github.com/apache/incubator-pegasus/pull/1455#discussion_r1170957831


##########
src/replica/replica.h:
##########
@@ -284,7 +284,7 @@ class replica : public serverlet<replica>, public 
ref_counter, public replica_ba
     //
     // Statistics
     //
-    void update_commit_qps(int count);
+    METRIC_DECLARE_INCREMENT_BY(committed_requests, );

Review Comment:
   It's strange too to pass such style of parameters.



##########
src/replica/replica.cpp:
##########
@@ -229,11 +228,7 @@ void replica::update_last_checkpoint_generate_time()
 //            //
 // Statistics //
 //            //
-
-void replica::update_commit_qps(int count)
-{
-    _stub->_counter_replicas_commit_qps->add((uint64_t)count);
-}
+METRIC_IMPL_INCREMENT_BY(*_stub, committed_requests, replica::)

Review Comment:
   It‘s a bit of strange to pass a namesapce as a "parameter", would it better 
to define functions manually?



##########
src/replica/replica_stub.cpp:
##########
@@ -2032,10 +2042,10 @@ task_ptr replica_stub::begin_open_replica(
         if (rep->status() == partition_status::PS_INACTIVE && 
tsk->cancel(false)) {
             // reopen it
             _closing_replicas.erase(it);
-            _counter_replicas_closing_count->decrement();
+            METRIC_VAR_DECREMENT(closing_replicas);

Review Comment:
   If needed, it's better to consider define a new metric type `FunctionGauge`, 
ref https://github.com/apache/kudu/blob/master/src/kudu/util/metrics.h#L1223
   
   We can improve it in future refactoring.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to