Package ai.djl.metric
Class Metric
- java.lang.Object
-
- ai.djl.metric.Metric
-
public class Metric extends java.lang.Object
A class representing a single recordedMetric
value.- See Also:
Metrics
-
-
Constructor Summary
Constructors Constructor Description Metric(java.lang.String metricName, java.lang.Number value)
Constructs aMetric
instance with the specifiedmetricName
andvalue
.Metric(java.lang.String metricName, java.lang.Number value, Unit unit)
Constructs aMetric
instance with the specifiedmetricName
,value
, andunit
.Metric(java.lang.String metricName, java.lang.Number value, Unit unit, Dimension... dimensions)
Constructs aMetric
instance with the specifiedmetricName
,value
, andunit
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Dimension[]
getDimensions()
Returns the metric dimensions.java.lang.String
getMetricName()
Returns the name of theMetric
.java.lang.String
getTimestamp()
Returns the timestamp of theMetric
.Unit
getUnit()
Returns the unit of theMetric
.java.lang.Double
getValue()
Returns the int value of theMetric
.static Metric
parse(java.lang.String line)
Returns aMetric
instance parsed from the log string.java.lang.String
toString()
-
-
-
Constructor Detail
-
Metric
public Metric(java.lang.String metricName, java.lang.Number value)
Constructs aMetric
instance with the specifiedmetricName
andvalue
.- Parameters:
metricName
- the metric namevalue
- the metric value
-
Metric
public Metric(java.lang.String metricName, java.lang.Number value, Unit unit)
Constructs aMetric
instance with the specifiedmetricName
,value
, andunit
.- Parameters:
metricName
- the metric namevalue
- the metric valueunit
- the metric unit
-
Metric
public Metric(java.lang.String metricName, java.lang.Number value, Unit unit, Dimension... dimensions)
Constructs aMetric
instance with the specifiedmetricName
,value
, andunit
.- Parameters:
metricName
- the metric namevalue
- the metric valueunit
- the metric unitdimensions
- the metric dimensions
-
-
Method Detail
-
getMetricName
public java.lang.String getMetricName()
Returns the name of theMetric
.- Returns:
- the metric name
-
getValue
public java.lang.Double getValue()
Returns the int value of theMetric
.- Returns:
- the metric value in int
-
getUnit
public Unit getUnit()
Returns the unit of theMetric
.- Returns:
- the metric unit
-
getTimestamp
public java.lang.String getTimestamp()
Returns the timestamp of theMetric
.- Returns:
- the metric timestamp
-
getDimensions
public Dimension[] getDimensions()
Returns the metric dimensions.- Returns:
- the metric dimensions
-
parse
public static Metric parse(java.lang.String line)
Returns aMetric
instance parsed from the log string.- Parameters:
line
- the input string- Returns:
- a
Metric
object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-