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 booleanequals(Object obj)StringgetName()Returns the name of the metric.DategetTimestamp()TgetValue()Returns the value of the metric.inthashCode()Metric<Long>increment(int amount)Create a newMetricwith an incremented value.<S extends Number>
Metric<S>set(S value)Create a newMetricwith a different value.StringtoString()
Method Detail
getTimestamp
public Date getTimestamp()
increment
public Metric<Long> increment(int amount)
Create a newMetricwith an incremented value.- Parameters:
amount- the amount that the new metric will differ from this one- Returns:
- a new
Metricinstance
set
public <S extends Number> Metric<S> set(S value)
Create a newMetricwith a different value.- Type Parameters:
S- the metric value type- Parameters:
value- the value of the new metric- Returns:
- a new
Metricinstance