Class Metric<T extends Number>
- java.lang.Object
- org.springframework.boot.actuate.metrics.Metric<T>
- Type Parameters:
T
- the value type
- Direct Known Subclasses:
Delta
public class Metric<T extends Number> extends Object
Immutable class that can be used to hold any arbitrary system measurement value (a named numeric value with a timestamp). For example a metric might record the number of active connections to a server, or the temperature of a meeting room.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
String
getName()
Returns the name of the metric.Date
getTimestamp()
T
getValue()
Returns the value of the metric.int
hashCode()
Metric<Long>
increment(int amount)
Create a newMetric
with an incremented value.<S extends Number>
Metric<S>set(S value)
Create a newMetric
with a different value.String
toString()
Method Detail
getTimestamp
public Date getTimestamp()
increment
public Metric<Long> increment(int amount)
Create a newMetric
with an incremented value.- Parameters:
amount
- the amount that the new metric will differ from this one- Returns:
- a new
Metric
instance
set
public <S extends Number> Metric<S> set(S value)
Create a newMetric
with a different value.- Type Parameters:
S
- the metric value type- Parameters:
value
- the value of the new metric- Returns:
- a new
Metric
instance