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 2021/08/30 04:48:30 UTC
[GitHub] [pulsar] hangc0276 commented on a change in pull request #11739: Expose compaction metrics to Prometheus
hangc0276 commented on a change in pull request #11739:
URL: https://github.com/apache/pulsar/pull/11739#discussion_r698159643
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java
##########
@@ -1906,14 +1908,19 @@ public TopicStatsImpl getStats(boolean getPreciseBacklog, boolean subscriptionBa
stats.lastOffloadSuccessTimeStamp = ledger.getLastOffloadedSuccessTimestamp();
stats.lastOffloadFailureTimeStamp = ledger.getLastOffloadedFailureTimestamp();
Optional<CompactorMXBean> mxBean = getCompactorMXBean();
- stats.compaction.lastCompactionRemovedEventCount = mxBean.map(stat ->
- stat.getLastCompactionRemovedEventCount(topic)).orElse(0L);
- stats.compaction.lastCompactionSucceedTimestamp = mxBean.map(stat ->
- stat.getLastCompactionSucceedTimestamp(topic)).orElse(0L);
- stats.compaction.lastCompactionFailedTimestamp = mxBean.map(stat ->
- stat.getLastCompactionFailedTimestamp(topic)).orElse(0L);
- stats.compaction.lastCompactionDurationTimeInMills = mxBean.map(stat ->
- stat.getLastCompactionDurationTimeInMills(topic)).orElse(0L);
+
+ stats.compaction.lastCompactionRemovedEventCount = 0L;
+ stats.compaction.lastCompactionSucceedTimestamp = 0L;
+ stats.compaction.lastCompactionFailedTimestamp = 0L;
+ stats.compaction.lastCompactionDurationTimeInMills = 0L;
Review comment:
```java
stats.compaction.lastCompactionRemovedEventCount = 0L;
stats.compaction.lastCompactionSucceedTimestamp = 0L;
stats.compaction.lastCompactionFailedTimestamp = 0L;
stats.compaction.lastCompactionDurationTimeInMills = 0L;
```
replace with `stats.compaction.reset(); ` ?
--
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