diff --git a/server/src/main/java/com/hedera/block/server/metrics/MetricsInjectionModule.java b/server/src/main/java/com/hedera/block/server/metrics/MetricsInjectionModule.java index 424856837..96c001ad9 100644 --- a/server/src/main/java/com/hedera/block/server/metrics/MetricsInjectionModule.java +++ b/server/src/main/java/com/hedera/block/server/metrics/MetricsInjectionModule.java @@ -31,6 +31,7 @@ public interface MetricsInjectionModule { /** * Provides the metrics service. * + * @param metricsService the metrics service to be used * @return the metrics service */ @Singleton diff --git a/server/src/main/java/com/hedera/block/server/metrics/MetricsService.java b/server/src/main/java/com/hedera/block/server/metrics/MetricsService.java index 75d1fc971..c152a3dd8 100644 --- a/server/src/main/java/com/hedera/block/server/metrics/MetricsService.java +++ b/server/src/main/java/com/hedera/block/server/metrics/MetricsService.java @@ -19,16 +19,33 @@ import com.swirlds.metrics.api.Counter; import com.swirlds.metrics.api.LongGauge; +/** Use member variables of this class to update metric data for the Hedera Block Node. */ public interface MetricsService { - /** Update the counter of live block items transiting via the live stream. */ + /** + * Update the counter of live block items transiting via the live stream. + * + * @return use this metric to increase the counter of block items received + */ Counter liveBlockItems(); - /** Update the counter of blocks persisted to storage. */ + /** + * Update the counter of blocks persisted to storage. + * + * @return use this counter to increase the amount of blocks persisted to disk + */ Counter blocksPersisted(); - /** Update the counter of single blocks retrieved from storage. */ + /** + * Update the counter of single blocks retrieved from storage. + * + * @return use this metric to increase the counter of single blocks retrieved + */ Counter singleBlocksRetrieved(); - /** Update the gauge of subscribers currently consuming to the live stream. */ + /** + * Update the gauge of subscribers currently consuming to the live stream. + * + * @return Use this to increase or decrease the amount of current subscribers to the live stream + */ LongGauge subscribers(); } diff --git a/server/src/main/java/com/hedera/block/server/metrics/MetricsServiceImpl.java b/server/src/main/java/com/hedera/block/server/metrics/MetricsServiceImpl.java index 3b4c5539e..a05052df0 100644 --- a/server/src/main/java/com/hedera/block/server/metrics/MetricsServiceImpl.java +++ b/server/src/main/java/com/hedera/block/server/metrics/MetricsServiceImpl.java @@ -59,24 +59,28 @@ public class MetricsServiceImpl implements MetricsService { /** Update the counter of live block items transiting via the live stream. */ @Override + @NonNull public final Counter liveBlockItems() { return liveBlockItems; } /** Update the counter of blocks persisted to storage. */ @Override + @NonNull public final Counter blocksPersisted() { return blocksPersisted; } /** Update the counter of single blocks retrieved from storage. */ @Override + @NonNull public final Counter singleBlocksRetrieved() { return singleBlocksRetrieved; } /** Update the gauge of subscribers currently consuming to the live stream. */ @Override + @NonNull public final LongGauge subscribers() { return subscribers; } diff --git a/server/src/test/java/com/hedera/block/server/config/TestConfigBuilder.java b/server/src/test/java/com/hedera/block/server/config/TestConfigBuilder.java index fc627f50e..b94c84811 100644 --- a/server/src/test/java/com/hedera/block/server/config/TestConfigBuilder.java +++ b/server/src/test/java/com/hedera/block/server/config/TestConfigBuilder.java @@ -166,6 +166,7 @@ public TestConfigBuilder withValue( * @return the created configuration */ @NonNull + @SuppressWarnings({"removal"}) public Configuration getOrCreateConfig() { try (final Locked ignore = configLock.lock()) { if (configuration == null) {