HADOOP-15657 Registering MutableQuantiles via Metric annotation. Contributed by Sushil Ks
This commit is contained in:
parent
8286bf2d1f
commit
962089ab59
|
@ -68,4 +68,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