Package ai.djl.metric

Class Metric

java.lang.Object
ai.djl.metric.Metric

public class Metric extends Object
A class representing a single recorded Metric value.
See Also:
  • Constructor Details

    • Metric

      public Metric(String metricName, Number value)
      Constructs a Metric instance with the specified metricName and value.
      Parameters:
      metricName - the metric name
      value - the metric value
    • Metric

      public Metric(String metricName, Number value, Unit unit)
      Constructs a Metric instance with the specified metricName, value , and unit.
      Parameters:
      metricName - the metric name
      value - the metric value
      unit - the metric unit
    • Metric

      public Metric(String metricName, Number value, Unit unit, Dimension... dimensions)
      Constructs a Metric instance with the specified metricName, value , and unit.
      Parameters:
      metricName - the metric name
      value - the metric value
      unit - the metric unit
      dimensions - the metric dimensions
  • Method Details

    • copyOf

      public Metric copyOf(String name)
      Returns a copy of the metric with a new name.
      Parameters:
      name - the new metric name
      Returns:
      a copy of the metric
    • getMetricName

      public String getMetricName()
      Returns the name of the Metric.
      Returns:
      the metric name
    • getValue

      public Double getValue()
      Returns the int value of the Metric.
      Returns:
      the metric value in int
    • getUnit

      public Unit getUnit()
      Returns the unit of the Metric.
      Returns:
      the metric unit
    • getTimestamp

      public String getTimestamp()
      Returns the timestamp of the Metric.
      Returns:
      the metric timestamp
    • getDimensions

      public Dimension[] getDimensions()
      Returns the metric dimensions.
      Returns:
      the metric dimensions
    • parse

      public static Metric parse(String line)
      Returns a Metric instance parsed from the log string.
      Parameters:
      line - the input string
      Returns:
      a Metric object
    • toString

      public String toString()
      Overrides:
      toString in class Object