java.lang.Object
org.sentrysoftware.metricshub.engine.strategy.utils.CollectHelper

public class CollectHelper extends Object
The CollectHelper class provides utility methods for extracting metric values and collect times from Monitor instances. It includes methods for working with both NumberMetric and StateSetMetric. The class is designed to have a private no-argument constructor to prevent instantiation.
  • Constructor Details

    • CollectHelper

      public CollectHelper()
  • Method Details

    • getNumberMetricValue

      public static Double getNumberMetricValue(Monitor monitor, String metricName, boolean previous)
      Get the NumberMetric value
      Parameters:
      monitor - The Monitor instance we wish to extract the NumberMetric value
      metricName - The name of the NumberMetric instance
      previous - Indicate whether we should return the value or the previousValue.
      Returns:
      a Double value
    • getStateSetMetricValue

      public static String getStateSetMetricValue(Monitor monitor, String metricName, boolean previous)
      Get the StateSetMetric value.
      Parameters:
      monitor - The Monitor instance from which to extract the StateSetMetric value.
      metricName - The name of the StateSetMetric instance.
      previous - Indicate whether to return the value or the previousValue.
      Returns:
      The String value.
    • getNumberMetricCollectTime

      public static Double getNumberMetricCollectTime(Monitor monitor, String metricRateName, boolean previous)
      Get the NumberMetric collect time
      Parameters:
      monitor - The Monitor instance we wish to extract the NumberMetric collect time
      metricRateName - The name of the NumberMetric instance
      previous - Indicate whether we should return the collectTime or the previousCollectTime.
      Returns:
      a Double value
    • getDoubleValue

      public static Double getDoubleValue(Number number)
      Return the Double value of the given Number instance
      Parameters:
      number - The Number whose Double value should be extracted from
      Returns:
      Double instance
    • getUpdatedNumberMetricValue

      public static Double getUpdatedNumberMetricValue(Monitor monitor, String metricName)
      Get the updated NumberMetric value
      Parameters:
      monitor - The Monitor instance we wish to extract the NumberMetric value
      metricName - The name of the NumberMetric instance
      Returns:
      a Double value