E
- the entity classpublic class MetricSample<E extends Entity> extends Object
Modifier and Type | Field and Description |
---|---|
protected E |
entity |
protected long |
sampleCloseTime |
protected long |
sampleOpenTime |
protected Map<Short,Double> |
valuesByMetricId |
Constructor and Description |
---|
MetricSample(E entity) |
Modifier and Type | Method and Description |
---|---|
Map<Short,Double> |
allMetricValues() |
void |
close(long closingTime)
Close this metric sample.
|
E |
entity()
Get the entity this metric sample is corresponding to.
|
boolean |
isValid(MetricDef metricDef)
Validate the metric sample.
|
protected MetricDef |
metricDefForToString()
A method that can be overridden by subclasses to get prettier toString() format.
|
Double |
metricValue(short metricId)
The metric for the specified metric id.
|
void |
open(long openingTime)
Open this metric sample with a timestamp denoting the timestamp of the oldest metric contained
in this sample.
|
void |
record(MetricInfo info,
double sampleValue)
Record a sample value for the given metric info.
|
long |
sampleCloseTime()
The time upon which the sample was closed.
|
long |
sampleOpenTime()
The time upon which the sample was opened.
|
String |
toString() |
protected long sampleOpenTime
protected long sampleCloseTime
public MetricSample(E entity)
public void record(MetricInfo info, double sampleValue)
info
- The MetricInfo
sampleValue
- the sample value.IllegalStateException
- if the sample is not opened or the metric has been already closedpublic E entity()
public long sampleOpenTime()
public long sampleCloseTime()
public Double metricValue(short metricId)
public void open(long openingTime)
public void close(long closingTime)
protected MetricDef metricDefForToString()
MetricDef
used for toString() method.public boolean isValid(MetricDef metricDef)