From 1fe4e372c51b9a6b926da2d63b068ae873e42558 Mon Sep 17 00:00:00 2001
From: Austin Littley <102969658+alittley@users.noreply.github.com>
Date: Thu, 4 Jan 2024 14:17:03 -0500
Subject: [PATCH] fix: Solve bad metric units (#10777)
Signed-off-by: Austin Littley
---
.../platform/event/linking/InOrderLinker.java | 19 +++++++++----------
.../event/preconsensus/PcesMetrics.java | 4 ++--
.../metrics/ConsensusHandlingMetrics.java | 2 +-
.../state/address/AddressBookMetrics.java | 2 +-
4 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/linking/InOrderLinker.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/linking/InOrderLinker.java
index b6efdd474a86..8467ad0e4876 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/linking/InOrderLinker.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/linking/InOrderLinker.java
@@ -124,20 +124,19 @@ public InOrderLinker(
this.missingParentAccumulator = platformContext
.getMetrics()
.getOrCreate(new LongAccumulator.Config(PLATFORM_CATEGORY, "missingParents")
- .withDescription("Parent child relationships where a parent was missing")
- .withUnit("parent child relationships"));
+ .withDescription("Parent child relationships where a parent was missing"));
this.generationMismatchAccumulator = platformContext
.getMetrics()
- .getOrCreate(new LongAccumulator.Config(PLATFORM_CATEGORY, "parentGenerationMismatch")
- .withDescription(
- "Parent child relationships where claimed parent generation did not match actual parent generation")
- .withUnit("parent child relationships"));
+ .getOrCreate(
+ new LongAccumulator.Config(PLATFORM_CATEGORY, "parentGenerationMismatch")
+ .withDescription(
+ "Parent child relationships where claimed parent generation did not match actual parent generation"));
this.timeCreatedMismatchAccumulator = platformContext
.getMetrics()
- .getOrCreate(new LongAccumulator.Config(PLATFORM_CATEGORY, "timeCreatedMismatch")
- .withDescription(
- "Parent child relationships where child time created wasn't strictly after parent time created")
- .withUnit("parent child relationships"));
+ .getOrCreate(
+ new LongAccumulator.Config(PLATFORM_CATEGORY, "timeCreatedMismatch")
+ .withDescription(
+ "Parent child relationships where child time created wasn't strictly after parent time created"));
}
/**
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/preconsensus/PcesMetrics.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/preconsensus/PcesMetrics.java
index 1c6d156a4bb8..7ee5499c3232 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/preconsensus/PcesMetrics.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/event/preconsensus/PcesMetrics.java
@@ -70,13 +70,13 @@ public class PcesMetrics {
private static final LongGauge.Config PRECONSENSUS_EVENT_FILE_OLDEST_GENERATION_CONFIG = new LongGauge.Config(
CATEGORY, "preconsensusEventFileOldestGeneration")
- .withUnit("oldest generation")
+ .withUnit("generation")
.withDescription("The oldest possible generation that is being " + "stored in preconsensus event files.");
private final LongGauge preconsensusEventFileOldestGeneration;
private static final LongGauge.Config PRECONSENSUS_EVENT_FILE_YOUNGEST_GENERATION_CONFIG = new LongGauge.Config(
CATEGORY, "preconsensusEventFileYoungestGeneration")
- .withUnit("youngest generation")
+ .withUnit("generation")
.withDescription("The youngest possible generation that is being " + "stored in preconsensus event files.");
private final LongGauge preconsensusEventFileYoungestGeneration;
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/metrics/ConsensusHandlingMetrics.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/metrics/ConsensusHandlingMetrics.java
index 56e6e77726f8..98869108a65b 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/metrics/ConsensusHandlingMetrics.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/metrics/ConsensusHandlingMetrics.java
@@ -46,7 +46,7 @@ public class ConsensusHandlingMetrics {
private static final LongGauge.Config consensusTimeConfig = new LongGauge.Config(INTERNAL_CATEGORY, "consensusTime")
.withDescription("The consensus timestamp of the round currently being handled.")
- .withUnit("milliseconds since the epoch");
+ .withUnit("milliseconds");
private final LongGauge consensusTime;
private static final LongGauge.Config consensusTimeDeviationConfig = new LongGauge.Config(
diff --git a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/address/AddressBookMetrics.java b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/address/AddressBookMetrics.java
index dc8837f743a1..45a70da94d3d 100644
--- a/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/address/AddressBookMetrics.java
+++ b/platform-sdk/swirlds-platform-core/src/main/java/com/swirlds/platform/state/address/AddressBookMetrics.java
@@ -42,7 +42,7 @@ public static void registerAddressBookMetrics(
@NonNull final Metrics metrics, @NonNull final AddressBook addressBook, @NonNull final NodeId selfId) {
metrics.getOrCreate(new FunctionGauge.Config<>(INFO_CATEGORY, "memberID", Long.class, selfId::id)
- .withUnit("node ID")
+ .withUnit("nodeID")
.withDescription("The node ID number of this member"));
metrics.getOrCreate(new FunctionGauge.Config<>(INFO_CATEGORY, "members", Integer.class, addressBook::getSize)