dragosvictor commented on code in PR #23035:
URL: https://github.com/apache/pulsar/pull/23035#discussion_r1680352885


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java:
##########
@@ -3691,16 +3708,22 @@ public boolean isBrokerPayloadProcessorEnabled() {
         return !brokerEntryPayloadProcessors.isEmpty();
     }
 
-    public void pausedConnections(int numberOfConnections) {
-        pausedConnections.add(numberOfConnections);
+    public void recordConnectionPaused() {
+        rateLimitedConnectionsCounter.add(1, 
ConnectionRateLimitOperationName.PAUSED.attributes);
+    }
+
+    public void recordConnectionResumed() {
+        rateLimitedConnectionsCounter.add(1, 
ConnectionRateLimitOperationName.RESUMED.attributes);
     }
 
-    public void resumedConnections(int numberOfConnections) {
-        pausedConnections.add(-numberOfConnections);
+    public void recordConnectionThrottled() {
+        rateLimitedConnectionsCounter.add(1, 
ConnectionRateLimitOperationName.THROTTLED.attributes);
+        throttledConnectionsGauge.inc();

Review Comment:
   It would. The unit for this metric is `{operation}`, reflecting that there 
is no 1-1 map between this throttle state and a connection.
   
   The current Prometheus value can be extracted by subtracting the `throttled` 
counter from the `unthrottled` one. This can prove insufficient to debug 
issues, as many connections can be throttled and unthrottled in between metric 
collection runs, so emitting just the delta is not enough.
   
   Same applies for pause/resume attributes, of course.



-- 
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: commits-unsubscr...@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to