Object o = metricsRateAttributeMod.get(attributeName);
if (o == null) {
o = metricsRegistry.get(attributeName);
}
if (o == null)
throw new AttributeNotFoundException();
if (o instanceof MetricsIntValue)
return ((MetricsIntValue) o).get();
else if (o instanceof MetricsLongValue)
return ((MetricsLongValue) o).get();
else if (o instanceof MetricsTimeVaryingInt)
return ((MetricsTimeVaryingInt) o).getPreviousIntervalValue();
else if (o instanceof MetricsTimeVaryingLong)
return ((MetricsTimeVaryingLong) o).getPreviousIntervalValue();
else if (o instanceof MetricsTimeVaryingRate) {
MetricsTimeVaryingRate or = (MetricsTimeVaryingRate) o;
if (attributeName.endsWith(NUM_OPS))
return or.getPreviousIntervalNumOps();
else if (attributeName.endsWith(AVG_TIME))
return or.getPreviousIntervalAverageTime();
else if (attributeName.endsWith(MIN_TIME))
return or.getMinTime();
else if (attributeName.endsWith(MAX_TIME))
return or.getMaxTime();
else {
MetricsUtil.LOG.error("Unexpected attrubute suffix");
throw new AttributeNotFoundException();
}
} else {
MetricsUtil.LOG.error("unknown metrics type: " + o.getClass().getName());
throw new AttributeNotFoundException();
}
}