HADOOP-15657 Registering MutableQuantiles via Metric annotation. Contributed by Sushil Ks
This commit is contained in:
parent
0468b6e736
commit
f6e4b13d5f
|
@ -67,4 +67,9 @@ public @interface Metric {
|
||||||
* @return optional type (counter|gauge) of the metric
|
* @return optional type (counter|gauge) of the metric
|
||||||
*/
|
*/
|
||||||
Type type() default Type.DEFAULT;
|
Type type() default Type.DEFAULT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return optional roll over interval in secs for MutableQuantiles
|
||||||
|
*/
|
||||||
|
int interval() default 10;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,10 @@ public class MutableMetricsFactory {
|
||||||
return registry.newMutableRollingAverages(info.name(),
|
return registry.newMutableRollingAverages(info.name(),
|
||||||
annotation.valueName());
|
annotation.valueName());
|
||||||
}
|
}
|
||||||
|
if (cls == MutableQuantiles.class) {
|
||||||
|
return registry.newQuantiles(info.name(), annotation.about(),
|
||||||
|
annotation.sampleName(), annotation.valueName(), annotation.interval());
|
||||||
|
}
|
||||||
throw new MetricsException("Unsupported metric field "+ field.getName() +
|
throw new MetricsException("Unsupported metric field "+ field.getName() +
|
||||||
" of type "+ field.getType().getName());
|
" of type "+ field.getType().getName());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue