java.lang.Object
java.lang.Enum<MetricType>
org.opensearch.plugin.insights.rules.model.MetricType
All Implemented Interfaces:
Serializable, Comparable<MetricType>, Comparator<Number>

public enum MetricType extends Enum<MetricType> implements Comparator<Number>
Valid metric types for a search query record
Opensearch.internal:
  • Enum Constant Details

    • LATENCY

      public static final MetricType LATENCY
      Latency metric type
    • CPU

      public static final MetricType CPU
      CPU usage metric type
    • JVM

      public static final MetricType JVM
      JVM heap usage metric type
  • Method Details

    • values

      public static MetricType[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static MetricType valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum type has no constant with the specified name
      NullPointerException - if the argument is null
    • readFromStream

      public static MetricType readFromStream(org.opensearch.core.common.io.stream.StreamInput in) throws IOException
      Read a MetricType from a StreamInput
      Parameters:
      in - the StreamInput to read from
      Returns:
      MetricType
      Throws:
      IOException - IOException
    • fromString

      public static MetricType fromString(String metricType)
      Create MetricType from String
      Parameters:
      metricType - the String representation of MetricType
      Returns:
      MetricType
    • toString

      public String toString()
      Overrides:
      toString in class Enum<MetricType>
    • allMetricTypes

      public static Set<MetricType> allMetricTypes()
      Get all valid metrics
      Returns:
      A set of String that contains all valid metrics
    • compare

      public int compare(Number a, Number b)
      Compare two numbers based on the metric type
      Specified by:
      compare in interface Comparator<Number>
      Parameters:
      a - the first Number to be compared.
      b - the second Number to be compared.
      Returns:
      a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second