You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/10/26 19:20:24 UTC
[GitHub] [pulsar] rdhabalia opened a new pull request, #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
rdhabalia opened a new pull request, #18212:
URL: https://github.com/apache/pulsar/pull/18212
### Motivation
Right now, client is not able to fetch producer/consumer stats for individual partition if topic is partitioned topic and it returns non-set value `0` or some aggregate value across all partitions which is not useful if client wants to track individual partition in case if any specific partition is having issue at broker side and individual partition metrics are useful for debugging issue specially various latency metrics.
### Modifications
Add API to fetch producer/consumer stats for partition topics.
### Verifying this change
- [ ] Make sure that the change passes the CI checks.
*(Please pick either of the following options)*
This change is a trivial rework / code cleanup without any test coverage.
*(or)*
This change is already covered by existing tests, such as *(please describe tests)*.
*(or)*
This change added tests and can be verified as follows:
*(example:)*
- *Added integration tests for end-to-end deployment with large payloads (10MB)*
- *Extended integration test for recovery after broker failure*
### Does this pull request potentially affect one of the following parts:
*If the box was checked, please highlight the changes*
- [ ] Dependencies (add or upgrade a dependency)
- [ ] The public API
- [ ] The schema
- [ ] The default values of configurations
- [ ] The threading model
- [ ] The binary protocol
- [ ] The REST endpoints
- [ ] The admin CLI options
- [ ] Anything that affects deployment
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. Please attach the local preview screenshots (run `sh start.sh` at `pulsar/site2/website`) to your PR description, or else your PR might not get merged. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: <!-- ENTER URL HERE -->
<!--
After opening this PR, the build in apache/pulsar will fail and instructions will
be provided for opening a PR in the PR author's forked repository.
apache/pulsar pull requests should be first tested in your own fork since the
apache/pulsar CI based on GitHub Actions has constrained resources and quota.
GitHub Actions provides separate quota for pull requests that are executed in
a forked repository.
The tests will be run in the forked repository until all PR review comments have
been handled, the tests pass and the PR is approved by a reviewer.
-->
--
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
[GitHub] [pulsar] rdhabalia commented on a diff in pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
rdhabalia commented on code in PR #18212:
URL: https://github.com/apache/pulsar/pull/18212#discussion_r1010843907
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerStatsDisabled.java:
##########
@@ -145,7 +146,12 @@ public void reset() {
}
@Override
- public void updateCumulativeStats(ConsumerStats stats) {
+ public void updateCumulativeStats(String partition, ConsumerStats stats) {
Review Comment:
I have removed the api change.
--
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
[GitHub] [pulsar] rdhabalia commented on a diff in pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
rdhabalia commented on code in PR #18212:
URL: https://github.com/apache/pulsar/pull/18212#discussion_r1007168628
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerStatsDisabled.java:
##########
@@ -145,7 +146,12 @@ public void reset() {
}
@Override
- public void updateCumulativeStats(ConsumerStats stats) {
+ public void updateCumulativeStats(String partition, ConsumerStats stats) {
Review Comment:
this method is only used by partitioned topic stats only and it's not part of public interface and used by internal Impl class only with single thread. so, there is no issue in changing the signature.
--
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
[GitHub] [pulsar] rdhabalia commented on a diff in pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
rdhabalia commented on code in PR #18212:
URL: https://github.com/apache/pulsar/pull/18212#discussion_r1008359531
##########
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ConsumerStats.java:
##########
@@ -114,4 +114,9 @@ public interface ConsumerStats extends Serializable {
* @return
*/
Map<Long, Integer> getMsgNumInSubReceiverQueue();
+
+ /**
+ * @return stats for each partition if topic is partitioned topic
+ */
+ Map<String, ConsumerStats> getPartitionStats();
Review Comment:
yes, that's a good idea to make partitioned stats more abstract and extendable.
--
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
[GitHub] [pulsar] rdhabalia commented on pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
rdhabalia commented on PR #18212:
URL: https://github.com/apache/pulsar/pull/18212#issuecomment-1298788164
@codelipenghui @AnonHxy comments are addressed. can you PTAL.
--
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
[GitHub] [pulsar] rdhabalia commented on a diff in pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
rdhabalia commented on code in PR #18212:
URL: https://github.com/apache/pulsar/pull/18212#discussion_r1006442974
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PartitionedProducerImpl.java:
##########
@@ -353,7 +353,8 @@ public synchronized ProducerStatsRecorderImpl getStats() {
return null;
}
stats.reset();
- producers.values().forEach(p -> stats.updateCumulativeStats(p.getStats()));
+ producers.forEach(
+ (partition, producer) -> stats.updateCumulativeStats(producer.getTopic(), producer.getStats()));
Review Comment:
here, we are keeping map of <topicName, stats> to maintain consistency with consumer-stats.
so, code change is correct where we are not using partition but we are using actual topic name of the partition.
--
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
[GitHub] [pulsar] rdhabalia commented on a diff in pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
rdhabalia commented on code in PR #18212:
URL: https://github.com/apache/pulsar/pull/18212#discussion_r1008359531
##########
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ConsumerStats.java:
##########
@@ -114,4 +114,9 @@ public interface ConsumerStats extends Serializable {
* @return
*/
Map<Long, Integer> getMsgNumInSubReceiverQueue();
+
+ /**
+ * @return stats for each partition if topic is partitioned topic
+ */
+ Map<String, ConsumerStats> getPartitionStats();
Review Comment:
yes, that's a good idea to make partitioned stats more abstract and extendable.
--
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
[GitHub] [pulsar] AnonHxy commented on a diff in pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
AnonHxy commented on code in PR #18212:
URL: https://github.com/apache/pulsar/pull/18212#discussion_r1006451057
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerStatsDisabled.java:
##########
@@ -145,7 +146,12 @@ public void reset() {
}
@Override
- public void updateCumulativeStats(ConsumerStats stats) {
+ public void updateCumulativeStats(String partition, ConsumerStats stats) {
Review Comment:
1. If we change the method singuture, I'm not sure will it bring some compatible problem, because this method is public.
2. The name of this method is `updateCumulativeStats`, doing some partitioned stats work is not `cumulative` I think. How about add a new method like `updatePartitionedStats()` :)
--
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
[GitHub] [pulsar] codelipenghui commented on a diff in pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
codelipenghui commented on code in PR #18212:
URL: https://github.com/apache/pulsar/pull/18212#discussion_r1007529202
##########
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ConsumerStats.java:
##########
@@ -114,4 +114,9 @@ public interface ConsumerStats extends Serializable {
* @return
*/
Map<Long, Integer> getMsgNumInSubReceiverQueue();
+
+ /**
+ * @return stats for each partition if topic is partitioned topic
+ */
+ Map<String, ConsumerStats> getPartitionStats();
Review Comment:
Here is not only about partition stats. Users can provide topic lists and topic patterns.
Is it better to use a new interface `MultiTopicConsumerStats extends ConsumerStats`?
For the producer side, we can have a new interface `PartitionedTopicProducerStats extends ProducerStats`
So that we can add new methods to the `MultiTopicConsumerStats` and `PartitionedTopicProducerStats` such `getStatsForInternalTopics` and `getStatsForPartitions`
--
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
[GitHub] [pulsar] rdhabalia merged pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
rdhabalia merged PR #18212:
URL: https://github.com/apache/pulsar/pull/18212
--
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
[GitHub] [pulsar] Technoboy- commented on a diff in pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
Technoboy- commented on code in PR #18212:
URL: https://github.com/apache/pulsar/pull/18212#discussion_r1006371623
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PartitionedProducerImpl.java:
##########
@@ -353,7 +353,8 @@ public synchronized ProducerStatsRecorderImpl getStats() {
return null;
}
stats.reset();
- producers.values().forEach(p -> stats.updateCumulativeStats(p.getStats()));
+ producers.forEach(
+ (partition, producer) -> stats.updateCumulativeStats(producer.getTopic(), producer.getStats()));
Review Comment:
`producer.getTopic()` -> `partition` ?
--
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
[GitHub] [pulsar] Technoboy- commented on a diff in pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
Technoboy- commented on code in PR #18212:
URL: https://github.com/apache/pulsar/pull/18212#discussion_r1006817634
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/PartitionedProducerImpl.java:
##########
@@ -353,7 +353,8 @@ public synchronized ProducerStatsRecorderImpl getStats() {
return null;
}
stats.reset();
- producers.values().forEach(p -> stats.updateCumulativeStats(p.getStats()));
+ producers.forEach(
+ (partition, producer) -> stats.updateCumulativeStats(producer.getTopic(), producer.getStats()));
Review Comment:
make sense
--
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
[GitHub] [pulsar] codecov-commenter commented on pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #18212:
URL: https://github.com/apache/pulsar/pull/18212#issuecomment-1292589836
# [Codecov](https://codecov.io/gh/apache/pulsar/pull/18212?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#18212](https://codecov.io/gh/apache/pulsar/pull/18212?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0427832) into [master](https://codecov.io/gh/apache/pulsar/commit/6c65ca0d8a80bfaaa4d5869e0cea485f5c94369b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6c65ca0) will **decrease** coverage by `11.95%`.
> The diff coverage is `30.86%`.
[![Impacted file tree graph](https://codecov.io/gh/apache/pulsar/pull/18212/graphs/tree.svg?width=650&height=150&src=pr&token=acYqCpsK9J&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/pulsar/pull/18212?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #18212 +/- ##
=============================================
- Coverage 34.91% 22.96% -11.96%
+ Complexity 5707 2875 -2832
=============================================
Files 607 372 -235
Lines 53396 41306 -12090
Branches 5712 4229 -1483
=============================================
- Hits 18644 9485 -9159
+ Misses 32119 30279 -1840
+ Partials 2633 1542 -1091
```
| Flag | Coverage Δ | |
|---|---|---|
| unittests | `22.96% <30.86%> (-11.96%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/pulsar/pull/18212?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../main/java/org/apache/pulsar/PulsarStandalone.java](https://codecov.io/gh/apache/pulsar/pull/18212/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL1B1bHNhclN0YW5kYWxvbmUuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [.../org/apache/pulsar/broker/admin/AdminResource.java](https://codecov.io/gh/apache/pulsar/pull/18212/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi9BZG1pblJlc291cmNlLmphdmE=) | `32.08% <0.00%> (-0.40%)` | :arrow_down: |
| [.../apache/pulsar/broker/admin/impl/ClustersBase.java](https://codecov.io/gh/apache/pulsar/pull/18212/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi9pbXBsL0NsdXN0ZXJzQmFzZS5qYXZh) | `3.33% <0.00%> (-5.72%)` | :arrow_down: |
| [...pache/pulsar/broker/admin/impl/NamespacesBase.java](https://codecov.io/gh/apache/pulsar/pull/18212/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi9pbXBsL05hbWVzcGFjZXNCYXNlLmphdmE=) | `7.45% <ø> (-7.08%)` | :arrow_down: |
| [.../pulsar/broker/admin/impl/SchemasResourceBase.java](https://codecov.io/gh/apache/pulsar/pull/18212/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi9pbXBsL1NjaGVtYXNSZXNvdXJjZUJhc2UuamF2YQ==) | `38.38% <0.00%> (-7.08%)` | :arrow_down: |
| [.../org/apache/pulsar/broker/admin/v2/Namespaces.java](https://codecov.io/gh/apache/pulsar/pull/18212/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9hZG1pbi92Mi9OYW1lc3BhY2VzLmphdmE=) | `4.87% <0.00%> (-3.16%)` | :arrow_down: |
| [...broker/delayed/InMemoryDelayedDeliveryTracker.java](https://codecov.io/gh/apache/pulsar/pull/18212/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9kZWxheWVkL0luTWVtb3J5RGVsYXllZERlbGl2ZXJ5VHJhY2tlci5qYXZh) | `0.00% <0.00%> (ø)` | |
| [.../pulsar/broker/service/AbstractBaseDispatcher.java](https://codecov.io/gh/apache/pulsar/pull/18212/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL0Fic3RyYWN0QmFzZURpc3BhdGNoZXIuamF2YQ==) | `34.35% <0.00%> (-11.51%)` | :arrow_down: |
| [...che/pulsar/broker/service/BacklogQuotaManager.java](https://codecov.io/gh/apache/pulsar/pull/18212/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL0JhY2tsb2dRdW90YU1hbmFnZXIuamF2YQ==) | `9.09% <0.00%> (-0.40%)` | :arrow_down: |
| [.../pulsar/broker/service/BrokerServiceException.java](https://codecov.io/gh/apache/pulsar/pull/18212/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cHVsc2FyLWJyb2tlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcHVsc2FyL2Jyb2tlci9zZXJ2aWNlL0Jyb2tlclNlcnZpY2VFeGNlcHRpb24uamF2YQ==) | `24.07% <0.00%> (-0.93%)` | :arrow_down: |
| ... and [371 more](https://codecov.io/gh/apache/pulsar/pull/18212/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
--
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
[GitHub] [pulsar] rdhabalia commented on a diff in pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
rdhabalia commented on code in PR #18212:
URL: https://github.com/apache/pulsar/pull/18212#discussion_r1008580773
##########
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ConsumerStats.java:
##########
@@ -114,4 +114,9 @@ public interface ConsumerStats extends Serializable {
* @return
*/
Map<Long, Integer> getMsgNumInSubReceiverQueue();
+
+ /**
+ * @return stats for each partition if topic is partitioned topic
+ */
+ Map<String, ConsumerStats> getPartitionStats();
Review Comment:
yes, sure, we can have separate interface for partitioned topic with more clear code.
However, the current implementation with combined stats-recorder and stats-interface implementation has complicated things though they are two separate entities (recorder can't become stats but recorder should record the stats ). combining both entities incorrectly complicates the inheritance.
We also should still keep the Partitioned topic abstraction from user. Producer/Consumer::getStats() should return one interface with all required API and user doesn't have to cast based on topic type. Because Partitioned-topic-stats are just a collection of stats so, we should have getPartitionedTopicStats() API with in Stats interface and it should return empty response if topic is not partitioned topic.
Atleast this will be a good start to creating the abstraction and without having existing API changes in this PR.
I will create a separate PR with further improvement.
This PR has addressed all comments.
--
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
[GitHub] [pulsar] rdhabalia commented on a diff in pull request #18212: [improve] [client] Add api to get producer/consumer stats for partition topic
Posted by GitBox <gi...@apache.org>.
rdhabalia commented on code in PR #18212:
URL: https://github.com/apache/pulsar/pull/18212#discussion_r1007168628
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerStatsDisabled.java:
##########
@@ -145,7 +146,12 @@ public void reset() {
}
@Override
- public void updateCumulativeStats(ConsumerStats stats) {
+ public void updateCumulativeStats(String partition, ConsumerStats stats) {
Review Comment:
this method is only used by partitioned topic stats only and it's not part of public interface and used by internal Impl class only with single thread. so, there is no issue in changing the signature.
--
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