You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "ywango (via GitHub)" <gi...@apache.org> on 2023/10/31 23:25:07 UTC

[I] [Bug] Mismatch of ProducerStats/ConsumerStats interface description and implementation [pulsar]

ywango opened a new issue, #21491:
URL: https://github.com/apache/pulsar/issues/21491

   ### Search before asking
   
   - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
   
   
   ### Version
   
   2.11.0 and above
   
   ### Minimal reproduce step
   
   1. Create a non-partitioned topic
   2. Create a producer with the default 60sec statsInterval that can publish messages to topic in step 1
   3. Publish 1 message every 10 sec, and 20 messages in total
   4. Fetch the producer stats every 20sec by querying `getStats()` method and print out values of [getNumMsgsSent()](https://github.com/apache/pulsar/blob/v3.1.0/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ProducerStats.java#L39C10-L39C24) and [getTotalMsgsSent()](https://github.com/apache/pulsar/blob/v3.1.0/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ProducerStats.java#L99) in [ProducerStats.java](https://github.com/apache/pulsar/blob/v3.1.0/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ProducerStats.java)
   5. Check the printed logs
   
   ### What did you expect to see?
   
   Both `getNumMsgsSent()` and `getTotalMsgsSent()` should be constant values during each statsInterval(60sec) per the [description](https://github.com/apache/pulsar/blob/v3.1.0/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ProducerStats.java#L30), as all stats are referring to the last recording period(last stats interval)
   
   ### What did you see instead?
   
   - `getNumMsgsSent()` is actually the number of messages published in the current interval, **NOT** the last interval
   - `getNumMsgsSent()` is being updated within the interval
   
   Implementation also indicates current interval
   [ProducerStatsRecorderImpl.java](https://github.com/apache/pulsar/blob/v3.1.0/pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerStatsRecorderImpl.java#L141-L144)
   
   ### Anything else?
   
   Client stats that are referring to current in progress interval
   - [ProducerStats](https://github.com/apache/pulsar/blob/v3.1.0/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ProducerStats.java#L36-L54) 
   - [ConsumerStats (part-1)](https://github.com/apache/pulsar/blob/v3.1.0/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ConsumerStats.java#L40-L45)
   - [ConsumerStats (part-2)](https://github.com/apache/pulsar/blob/v3.1.0/pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ConsumerStats.java#L60-L75)
   
   Is there any ongoing plan to fix the documentation or the implementation ? 
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


-- 
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-unsubscribe@pulsar.apache.org.apache.org

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


Re: [I] [Bug] Mismatch of ProducerStats/ConsumerStats interface description and implementation [pulsar]

Posted by "ywango (via GitHub)" <gi...@apache.org>.
ywango commented on issue #21491:
URL: https://github.com/apache/pulsar/issues/21491#issuecomment-1800273915

   > Please note this is in the same area code: #21393
   
   Hi @asafm, the same problem statement is already in place for [#21393](https://github.com/apache/pulsar/pull/21393) under the `Background knowledge` section


-- 
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-unsubscribe@pulsar.apache.org

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


Re: [I] [Bug] Mismatch of ProducerStats/ConsumerStats interface description and implementation [pulsar]

Posted by "asafm (via GitHub)" <gi...@apache.org>.
asafm commented on issue #21491:
URL: https://github.com/apache/pulsar/issues/21491#issuecomment-1791002754

   Please note this is in the same area code: https://github.com/apache/pulsar/pull/21393


-- 
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-unsubscribe@pulsar.apache.org

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


Re: [I] [Bug] Mismatch of ProducerStats/ConsumerStats interface description and implementation [pulsar]

Posted by "ywango (via GitHub)" <gi...@apache.org>.
ywango commented on issue #21491:
URL: https://github.com/apache/pulsar/issues/21491#issuecomment-1809319453

   Hi @merlimat @codelipenghui @315157973, would you mind provide any context for this issue as you all have been working on the stats recorder before?
   


-- 
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-unsubscribe@pulsar.apache.org

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