Repository navigation
Add filteredMsgCount for pulsar-admin broker-stats topics - #14531
Conversation
|
tests to be completed. |
|
@tjiuming:Thanks for your contribution. For this PR, do we need to update docs? |
|
@tjiuming:Thanks for providing doc info! |
codelipenghui
left a comment
There was a problem hiding this comment.
LGTM, please add tests.
| subscription.acknowledgeMessage(entriesToFiltered, AckType.Individual, | ||
| Collections.emptyMap()); | ||
|
|
||
| int filtered = entriesToFiltered.size(); |
There was a problem hiding this comment.
It's actually entry count, not message count. Please make it consist.
There was a problem hiding this comment.
make sense, I'll change the field name. Thanks!
| public void testFilteredMsgCount() throws Throwable{ | ||
| String topic = "persistent://prop/ns-abc/topic" + UUID.randomUUID(); | ||
| String subName = "sub"; | ||
| Consumer<String> consumer = pulsarClient.newConsumer(Schema.STRING).topic(topic) |
There was a problem hiding this comment.
| Consumer<String> consumer = pulsarClient.newConsumer(Schema.STRING).topic(topic) | |
| @Cleanup | |
| Consumer<String> consumer = pulsarClient.newConsumer(Schema.STRING).topic(topic) |
| EntryFilterWithClassLoader loader2 = spyWithClassAndConstructorArgs(EntryFilterWithClassLoader.class, filter2, narClassLoader); | ||
| field.set(dispatcher, ImmutableList.of(loader1, loader2)); | ||
|
|
||
| Producer<String> producer = pulsarClient.newProducer(Schema.STRING) |
There was a problem hiding this comment.
| Producer<String> producer = pulsarClient.newProducer(Schema.STRING) | |
| @Cleanup | |
| Producer<String> producer = pulsarClient.newProducer(Schema.STRING) |
|
|
||
| int counter = 0; | ||
| while (true) { | ||
| Message<String> message = consumer.receive(1, TimeUnit.SECONDS); |
There was a problem hiding this comment.
1 second might be too short in the CI environment if the broker dispatch messages slowly.
| import org.apache.pulsar.broker.service.BrokerService; | ||
| import org.apache.pulsar.broker.service.BrokerTestBase; | ||
| import org.apache.pulsar.broker.service.Dispatcher; | ||
| import org.apache.pulsar.broker.service.*; |
There was a problem hiding this comment.
Please avoid star import.
|
@codelipenghui changed, PTAL |
|
/pulsarbot run-failure-checks |
pulsar-admin topics statspulsar-admin topics stats
(cherry picked from commit d3ccd4a)
(cherry picked from commit d3ccd4a)
|
@tjiuming - thank you for adding these stats. Would you be able to add the documentation to the admin api docs https://pulsar.apache.org/docs/next/admin-api-topics#get-stats? |
pulsar-admin topics statspulsar-admin broker-stats topics
|
Note that this PR did not add these metrics to the |
All right |
(If this PR fixes a github issue, please add
Fixes #<xyz>.)Fixes: #14507
Motivation
see master issue
Modifications
msgFilteredCounterinAbstractTopicaddFilteredMsgCount,getMsgFilteredCountinAbstractTopicAbstractBaseDispatcher#filterEntriesForConsumerDoes this pull request potentially affect one of the following parts:
If
yeswas chosen, please highlight the changesDocumentation
Check the box below or label this PR directly (if you have committer privilege).
Need to update docs?
doc-required(If you need help on updating docs, create a doc issue)
no-need-doc(Please explain why)
doc(If this PR contains doc changes)
doc-not-needed