Skip to content

Add compacted topic metrics for TopicStats in CLI - #11564

Merged
codelipenghui merged 3 commits into
apache:masterfrom
Technoboy-:add-compacted-topic-metric-1
Aug 21, 2021
Merged

Add compacted topic metrics for TopicStats in CLI#11564
codelipenghui merged 3 commits into
apache:masterfrom
Technoboy-:add-compacted-topic-metric-1

Conversation

@Technoboy-

@Technoboy- Technoboy- commented Aug 5, 2021

Copy link
Copy Markdown
Contributor

Motivation

Add below metrics to help track potential flows or examine the overall condition of compacted topics .

  • lastCompactionRemovedEventCount : the removed event count of last compaction
  • lastCompactionSucceedTimestamp : the timestamp of last succeed compaction
  • lastCompactionFailedTimestamp : the timestamp of last failed compaction
  • lastCompactionDurationTimeInMills: the duration time of last compaction

These 4 metrics will be displayed in topic stats CLI :

./pulsar-admin topics stats persistent://tenant/ns/topic

Documentation

This patch will add metrics in CLI , which would generate doc automatically.

Technoboy- added a commit to Technoboy-/pulsar that referenced this pull request Aug 5, 2021
@Technoboy-
Technoboy- force-pushed the add-compacted-topic-metric-1 branch from c49abed to 81a7b49 Compare August 5, 2021 08:45
@zymap
zymap requested review from eolivelli, merlimat and zymap August 5, 2021 09:47
@zymap zymap added this to the 2.9.0 milestone Aug 5, 2021
@zymap
zymap requested review from codelipenghui and sijie and removed request for zymap August 5, 2021 10:08
@Anonymitaet Anonymitaet added the doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. label Aug 5, 2021
@Technoboy-

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested a few changes and asked some questions about design. I think the Sum class needs tests before this can be merged.

Comment thread pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorMXBeanImpl.java Outdated
Comment thread pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorMXBeanImpl.java Outdated
Comment thread pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorMXBeanImpl.java Outdated
Comment thread pulsar-common/src/main/java/org/apache/pulsar/common/stats/Sum.java
Comment thread pulsar-common/src/main/java/org/apache/pulsar/common/stats/Sum.java Outdated
@Technoboy- Technoboy- changed the title Add compacted topic metrics for TopicStats in CLI [WIP]Add compacted topic metrics for TopicStats in CLI Aug 10, 2021
@Technoboy-

Copy link
Copy Markdown
Contributor Author

I suggested a few changes and asked some questions about design. I think the Sum class needs tests before this can be merged.

Thanks for reviewing. Yesterday, we find that compacted topic has metrics in InternalStats which would be shown by:

./pulsar-admin topics stats-internal persistent://tenant/ns/topic

I may have to record other metrics except the above two compactedTopicSize ,compactedTopicMsgCount

Technoboy- added a commit to Technoboy-/pulsar that referenced this pull request Aug 10, 2021
@Technoboy-
Technoboy- force-pushed the add-compacted-topic-metric-1 branch from f729c2c to c6beb44 Compare August 10, 2021 10:18
@Technoboy- Technoboy- changed the title [WIP]Add compacted topic metrics for TopicStats in CLI Add compacted topic metrics for TopicStats in CLI Aug 10, 2021
Technoboy- added a commit to Technoboy-/pulsar that referenced this pull request Aug 11, 2021
@Technoboy-
Technoboy- force-pushed the add-compacted-topic-metric-1 branch from e8b4d0d to 89c90f9 Compare August 11, 2021 05:28
Comment thread pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java Outdated
Comment thread pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorMXBeanImpl.java Outdated
Comment thread pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorMXBeanImpl.java Outdated
Comment thread pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorMXBeanImpl.java Outdated
Comment thread pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorMXBean.java Outdated
Technoboy- added a commit to Technoboy-/pulsar that referenced this pull request Aug 16, 2021

@gaoran10 gaoran10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codelipenghui

Copy link
Copy Markdown
Contributor

@michaeljmarshall Please help review the PR again.

@codelipenghui

Copy link
Copy Markdown
Contributor

@michaeljmarshall Please help review the PR again.

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am concerned that the 2 hour fixed rate for cleanup will lead to incorrect metrics. I think it could be possible to implement the cleanup in a way that removes the possibility of serving incorrect metrics. Please let me know what you think.

Otherwise, this PR looks good to me.

Comment thread pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorMXBeanImpl.java Outdated
@Technoboy-

Copy link
Copy Markdown
Contributor Author

@michaeljmarshall @gaoran10 @codelipenghui thanks for reviewing.

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Good work! I left a couple comments. It's up to you if you want to address them or leave the PR as is.

Comment thread pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactorMXBeanImpl.java Outdated
@Technoboy-
Technoboy- force-pushed the add-compacted-topic-metric-1 branch from 6cbbb12 to c4b6e71 Compare August 21, 2021 02:50
@codelipenghui

Copy link
Copy Markdown
Contributor
Error:  Tests run: 28, Failures: 12, Errors: 0, Skipped: 13, Time elapsed: 601.287 s <<< FAILURE! - in org.apache.pulsar.functions.source.batch.BatchSourceExecutorTest
Error:  testPushLifeCycle(org.apache.pulsar.functions.source.batch.BatchSourceExecutorTest)  Time elapsed: 300.011 s  <<< FAILURE!
org.testng.internal.thread.ThreadTimeoutException: Method org.apache.pulsar.functions.source.batch.BatchSourceExecutorTest.testPushLifeCycle() didn't finish within the time-out 300000
	at org.testng.internal.MethodInvocationHelper.invokeWithTimeoutWithNewExecutor(MethodInvocationHelper.java:371)
	at org.testng.internal.MethodInvocationHelper.invokeWithTimeout(MethodInvocationHelper.java:282)
	at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:605)
	at org.testng.internal.TestInvoker.retryFailed(TestInvoker.java:214)
	at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:58)
	at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
	at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
	at org.testng.TestRunner.privateRun(TestRunner.java:764)
	at org.testng.TestRunner.run(TestRunner.java:585)
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:384)
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:378)
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:337)
	at org.testng.SuiteRunner.run(SuiteRunner.java:286)
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1218)
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
	at org.testng.TestNG.runSuites(TestNG.java:1069)
	at org.testng.TestNG.run(TestNG.java:1037)
	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:135)
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:112)
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeLazy(TestNGDirectoryTestSuite.java:123)
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:90)
	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:146)
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)

@Technoboy-

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

2 similar comments
@Technoboy-

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@Technoboy-

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@codelipenghui
codelipenghui merged commit c0ef593 into apache:master Aug 21, 2021
codelipenghui pushed a commit that referenced this pull request Aug 31, 2021
### Motivation
As #11564 has involved compaction metrics in CLI, it's extremely useful to expose relative metrics to Prometheus.

- pulsar_compaction_removed_event_count :  the removed event count of compaction .
- pulsar_compaction_succeed_count : the succeed count of compaction.
- pulsar_compaction_failed_count : the failed count of compaction.
- pulsar_compaction_duration_time_in_millis : the duration time of compaction.
- pulsar_compaction_read_throughput : the read throughput of compaction.
- pulsar_compaction_write_throughput : the write throughput of compaction.
- pulsar_compaction_compacted_entries_count: the compacted entries count.
- pulsar_compaction_compacted_entries_size: the compacted entries size;

if users enable the topic level metrics and the topic has been compacted or doing the compaction, we should expose the compaction metrics for the topic level. If users disable the topic level metrics, we should expose the aggregated compaction metrics for the namespace level.
codelipenghui pushed a commit that referenced this pull request Sep 2, 2021
Add below metrics to help track potential flows or examine the overall condition of compacted topics .
- lastCompactionRemovedEventCount : the removed event count of last compaction
- lastCompactionSucceedTimestamp : the timestamp of last succeed compaction
- lastCompactionFailedTimestamp : the timestamp of last failed compaction
- lastCompactionDurationTimeInMills: the duration time of last compaction

These 4 metrics will be displayed in topic stats CLI :
```
./pulsar-admin topics stats persistent://tenant/ns/topic
```

This patch will add metrics in CLI , which would generate doc automatically.

(cherry picked from commit c0ef593)
codelipenghui pushed a commit that referenced this pull request Sep 2, 2021
### Motivation
As #11564 has involved compaction metrics in CLI, it's extremely useful to expose relative metrics to Prometheus.

- pulsar_compaction_removed_event_count :  the removed event count of compaction .
- pulsar_compaction_succeed_count : the succeed count of compaction.
- pulsar_compaction_failed_count : the failed count of compaction.
- pulsar_compaction_duration_time_in_millis : the duration time of compaction.
- pulsar_compaction_read_throughput : the read throughput of compaction.
- pulsar_compaction_write_throughput : the write throughput of compaction.
- pulsar_compaction_compacted_entries_count: the compacted entries count.
- pulsar_compaction_compacted_entries_size: the compacted entries size;

if users enable the topic level metrics and the topic has been compacted or doing the compaction, we should expose the compaction metrics for the topic level. If users disable the topic level metrics, we should expose the aggregated compaction metrics for the namespace level.


(cherry picked from commit 656635e)
@codelipenghui codelipenghui added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Sep 2, 2021
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jan 25, 2022
Add below metrics to help track potential flows or examine the overall condition of compacted topics .
- lastCompactionRemovedEventCount : the removed event count of last compaction
- lastCompactionSucceedTimestamp : the timestamp of last succeed compaction
- lastCompactionFailedTimestamp : the timestamp of last failed compaction
- lastCompactionDurationTimeInMills: the duration time of last compaction

These 4 metrics will be displayed in topic stats CLI :
```
./pulsar-admin topics stats persistent://tenant/ns/topic
```

This patch will add metrics in CLI , which would generate doc automatically.

(cherry picked from commit c0ef593)
(cherry picked from commit 71cc13b)
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jan 25, 2022
### Motivation
As apache#11564 has involved compaction metrics in CLI, it's extremely useful to expose relative metrics to Prometheus.

- pulsar_compaction_removed_event_count :  the removed event count of compaction .
- pulsar_compaction_succeed_count : the succeed count of compaction.
- pulsar_compaction_failed_count : the failed count of compaction.
- pulsar_compaction_duration_time_in_millis : the duration time of compaction.
- pulsar_compaction_read_throughput : the read throughput of compaction.
- pulsar_compaction_write_throughput : the write throughput of compaction.
- pulsar_compaction_compacted_entries_count: the compacted entries count.
- pulsar_compaction_compacted_entries_size: the compacted entries size;

if users enable the topic level metrics and the topic has been compacted or doing the compaction, we should expose the compaction metrics for the topic level. If users disable the topic level metrics, we should expose the aggregated compaction metrics for the namespace level.

(cherry picked from commit 656635e)
(cherry picked from commit a80f1e8)
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this pull request Mar 18, 2022
### Motivation
Add below metrics to help track potential flows or examine the overall condition of compacted topics .
- lastCompactionRemovedEventCount : the removed event count of last compaction
- lastCompactionSucceedTimestamp : the timestamp of last succeed compaction
- lastCompactionFailedTimestamp : the timestamp of last failed compaction
- lastCompactionDurationTimeInMills: the duration time of last compaction

These 4 metrics will be displayed in topic stats CLI :
```
./pulsar-admin topics stats persistent://tenant/ns/topic
```

### Documentation
This patch will add metrics in CLI , which would generate doc automatically.
bharanic-dev pushed a commit to bharanic-dev/pulsar that referenced this pull request Mar 18, 2022
### Motivation
As apache#11564 has involved compaction metrics in CLI, it's extremely useful to expose relative metrics to Prometheus.

- pulsar_compaction_removed_event_count :  the removed event count of compaction .
- pulsar_compaction_succeed_count : the succeed count of compaction.
- pulsar_compaction_failed_count : the failed count of compaction.
- pulsar_compaction_duration_time_in_millis : the duration time of compaction.
- pulsar_compaction_read_throughput : the read throughput of compaction.
- pulsar_compaction_write_throughput : the write throughput of compaction.
- pulsar_compaction_compacted_entries_count: the compacted entries count.
- pulsar_compaction_compacted_entries_size: the compacted entries size;

if users enable the topic level metrics and the topic has been compacted or doing the compaction, we should expose the compaction metrics for the topic level. If users disable the topic level metrics, we should expose the aggregated compaction metrics for the namespace level.
@Technoboy-
Technoboy- deleted the add-compacted-topic-metric-1 branch August 10, 2022 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/admin area/metrics cherry-picked/branch-2.8 Archived: 2.8 is end of life doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. release/2.8.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants