hanmz opened a new pull request, #22518: URL: https://github.com/apache/pulsar/pull/22518
### Motivation In a production environment, we often encounter a scenario: send a message to create a producer, and then close it after use. At this time, we will see that the `msgRateIn` and `msgThroughputIn` in topics stats are always 0. This is because the msgRateIn and msgThroughputIn of the topic are calculated from the online producer. (Here I only optimized the production stats, and the consumption stats also have similar problems.) ### Modifications 1. We add `rateIn` statistics in topic to avoid relying on producers being online. 2. Here we also add an optional configuration to be compatible with the previous logic. ### Documentation <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. --> - [ ] `doc` <!-- Your PR contains doc changes. --> - [ ] `doc-required` <!-- Your PR changes impact docs and you will update later --> - [x] `doc-not-needed` <!-- Your PR changes do not impact docs --> - [ ] `doc-complete` <!-- Docs have been already added --> -- 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