rishabhdaim commented on code in PR #2216: URL: https://github.com/apache/jackrabbit-oak/pull/2216#discussion_r2056332881
########## oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/FullGCStatsCollectorImpl.java: ########## @@ -83,9 +84,15 @@ class FullGCStatsCollectorImpl implements FullGCStatsCollector { private final CounterStats counter; private final CounterStats failureCounter; + private static String METRICS_QUALIFIED_NAME_PREFIX; FullGCStatsCollectorImpl(StatisticsProvider provider) { + this(provider, false); + } + + FullGCStatsCollectorImpl(StatisticsProvider provider, boolean pushMetrics) { this.provider = provider; + this.METRICS_QUALIFIED_NAME_PREFIX = pushMetrics ? FULL_GC_PUSH_METRICS_PREFIX : FULL_GC; Review Comment: why can't we use the same metrics prefix here? ########## oak-run-commons/src/main/java/org/apache/jackrabbit/oak/run/cli/NodeStoreFixtureProvider.java: ########## @@ -100,15 +100,19 @@ private static boolean oldSegmentStore(Options options) { return !manifest.exists(); } - private static StatisticsProvider createStatsProvider(Options options, Whiteboard wb, Closer closer) { + public static StatisticsProvider createStatsProvider(Whiteboard wb, Closer closer) { + ScheduledExecutorService executorService = + MoreExecutors.getExitingScheduledExecutorService(new ScheduledThreadPoolExecutor(1)); + MetricStatisticsProvider statsProvider = new MetricStatisticsProvider(getPlatformMBeanServer(), executorService); + closer.register(statsProvider); + closer.register(() -> reportMetrics(statsProvider)); + wb.register(MetricRegistry.class, statsProvider.getRegistry(), emptyMap()); + return statsProvider; + } + + public static StatisticsProvider createStatsProvider(Options options, Whiteboard wb, Closer closer) { Review Comment: this should remain private. ########## oak-run/src/main/java/org/apache/jackrabbit/oak/run/RevisionsCommand.java: ########## @@ -211,6 +219,8 @@ private static class RevisionsOptions extends Utils.NodeStoreOptions { .withOptionalArg().ofType(Long.class).defaultsTo(TimeUnit.DAYS.toSeconds(1)); fullGCAuditLoggingEnabled = parser.accepts("fullGCAuditLoggingEnabled", "Enable audit logging for Full GC") .withOptionalArg().ofType(Boolean.class).defaultsTo(FALSE); + exportMetrics = parser.accepts("export-metrics", Review Comment: ```suggestion exportMetrics = parser.accepts("exportMetrics", ``` ########## oak-run/src/main/java/org/apache/jackrabbit/oak/run/RevisionsCommand.java: ########## @@ -211,6 +219,8 @@ private static class RevisionsOptions extends Utils.NodeStoreOptions { .withOptionalArg().ofType(Long.class).defaultsTo(TimeUnit.DAYS.toSeconds(1)); fullGCAuditLoggingEnabled = parser.accepts("fullGCAuditLoggingEnabled", "Enable audit logging for Full GC") .withOptionalArg().ofType(Boolean.class).defaultsTo(FALSE); + exportMetrics = parser.accepts("export-metrics", Review Comment: let's be consistent with other var names. -- 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: oak-dev-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org