You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2020/12/25 00:49:20 UTC

[pulsar] branch master updated: Add updateRates method for kop to collect publish rate (#9049)

This is an automated email from the ASF dual-hosted git repository.

penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new ccc3620  Add updateRates method for kop to collect publish rate (#9049)
ccc3620 is described below

commit ccc36208dad84ceba26b50a8add06fa5187d5dba
Author: dockerzhang <do...@apache.org>
AuthorDate: Fri Dec 25 08:48:51 2020 +0800

    Add updateRates method for kop to collect publish rate (#9049)
    
    Fixes #9048
    
    ### Motivation
    kop & pulsar use the same metrics collector, but kop can't collect publish rate now.
    https://github.com/streamnative/kop/issues/284
    
    ### Modifications
    
    add `updateRates` method for kop to collect publish rate
---
 .../src/main/java/org/apache/pulsar/broker/service/Producer.java       | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Producer.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Producer.java
index 2bca232..b78c870 100644
--- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Producer.java
+++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/Producer.java
@@ -586,7 +586,10 @@ public class Producer {
             msgDrop.calculateRate();
             ((NonPersistentPublisherStats) stats).msgDropRate = msgDrop.getRate();
         }
+    }
 
+    public void updateRates(int numOfMessages, long msgSizeInBytes) {
+        msgIn.recordMultipleEvents(numOfMessages, msgSizeInBytes);
     }
 
     public boolean isRemote() {