return super.getAttribute(name);
} catch (AttributeNotFoundException ex) {
checkAndUpdateAttributes();
MetricsBase metric = this.extendedAttributes.get(name);
if (metric != null) {
if (metric instanceof MetricsRate) {
return ((MetricsRate) metric).getPreviousIntervalValue();
} else if (metric instanceof MetricsString) {
return ((MetricsString)metric).getValue();
} else if (metric instanceof MetricsHistogram) {
MetricsHistogram hist = (MetricsHistogram) metric;
if (name.endsWith(MetricsHistogram.NUM_OPS_METRIC_NAME)) {
return hist.getCount();
} else if (name.endsWith(MetricsHistogram.MIN_METRIC_NAME)) {
return hist.getMin();
} else if (name.endsWith(MetricsHistogram.MAX_METRIC_NAME)) {
return hist.getMax();
} else if (name.endsWith(MetricsHistogram.MEAN_METRIC_NAME)) {
return (float) hist.getMean();
} else if (name.endsWith(MetricsHistogram.STD_DEV_METRIC_NAME)) {
return (float) hist.getStdDev();
} else if (name.endsWith(MetricsHistogram.MEDIAN_METRIC_NAME)) {
Snapshot s = hist.getSnapshot();
return (float) s.getMedian();
} else if (name.endsWith(MetricsHistogram.SEVENTY_FIFTH_PERCENTILE_METRIC_NAME)) {
Snapshot s = hist.getSnapshot();
return (float) s.get75thPercentile();
} else if (name.endsWith(MetricsHistogram.NINETY_FIFTH_PERCENTILE_METRIC_NAME)) {
Snapshot s = hist.getSnapshot();
return (float) s.get95thPercentile();
} else if (name.endsWith(MetricsHistogram.NINETY_NINETH_PERCENTILE_METRIC_NAME)) {
Snapshot s = hist.getSnapshot();
return (float) s.get99thPercentile();
}
} else {
LOG.warn( String.format("unknown metrics type %s for attribute %s",
metric.getClass().getName(), name) );
}
}
}
throw new AttributeNotFoundException();