public class MetricDef
extends java.lang.Object
MetricSampleAggregator
to look up the metrics.
Also, each metric can belong to a metric group. The metrics in the same metric group are expected to be of
the same type and unit. For example, the bytes in rate of the entire system may be divided into the bytes in
rate of a few subsystems. In this case, the metric bytes in rate of the subsystems can be defined within
the same metric group, so that they can be accumulated to the bytes in rate of the entire system.
This class is supposed to be initialized only once and passed around after the creation for read only.Constructor and Description |
---|
MetricDef() |
Modifier and Type | Method and Description |
---|---|
java.util.List<MetricInfo> |
all() |
MetricDef |
define(java.lang.String metricName,
java.lang.String group,
java.lang.String valueComputingStrategy)
Define the metric.
|
MetricDef |
define(java.lang.String metricName,
java.lang.String group,
java.lang.String valueComputingStrategy,
boolean toPredict)
Define the metric.
|
void |
doneDefinition()
Finish the metric definition and make the MetricDef immutable.
|
MetricInfo |
metricInfo(short id) |
MetricInfo |
metricInfo(java.lang.String name)
Get the metric id from the metric name.
|
java.util.List<MetricInfo> |
metricInfoForGroup(java.lang.String group)
Get all the metric info for the given group.
|
java.util.Set<java.lang.Short> |
metricsToPredict() |
int |
size() |
public MetricDef define(java.lang.String metricName, java.lang.String group, java.lang.String valueComputingStrategy)
metricName
- the name of the metricgroup
- the metric group this metric belongs to.valueComputingStrategy
- the AggregationFunction
for this metric.public MetricDef define(java.lang.String metricName, java.lang.String group, java.lang.String valueComputingStrategy, boolean toPredict)
metricName
- the name of the metricgroup
- the group the metric belongs to.valueComputingStrategy
- the AggregationFunction
for this metric.toPredict
- whether the metric is a metric to be predicted.public java.util.List<MetricInfo> metricInfoForGroup(java.lang.String group)
group
- the group to get the info.public void doneDefinition()
public MetricInfo metricInfo(java.lang.String name)
name
- the metric name.MetricInfo
associated with the metric name.public MetricInfo metricInfo(short id)
MetricInfo
by id;public java.util.Set<java.lang.Short> metricsToPredict()
public java.util.List<MetricInfo> all()
public int size()