use of org.apache.hadoop.hbase.util.LossyCounting in project hbase by apache.
the class MetaTableMetrics method start.
@Override
public void start(CoprocessorEnvironment env) throws IOException {
observer = new ExampleRegionObserverMeta();
if (env instanceof RegionCoprocessorEnvironment && ((RegionCoprocessorEnvironment) env).getRegionInfo().getTable() != null && ((RegionCoprocessorEnvironment) env).getRegionInfo().getTable().equals(TableName.META_TABLE_NAME)) {
RegionCoprocessorEnvironment regionCoprocessorEnv = (RegionCoprocessorEnvironment) env;
registry = regionCoprocessorEnv.getMetricRegistryForRegionServer();
LossyCounting.LossyCountingListener<String> listener = key -> {
registry.remove(key);
metrics.remove(key);
};
final Configuration conf = regionCoprocessorEnv.getConfiguration();
clientMetricsLossyCounting = new LossyCounting<>("clientMetaMetrics", conf, listener);
regionMetricsLossyCounting = new LossyCounting<>("regionMetaMetrics", conf, listener);
// only be active mode when this region holds meta table.
active = true;
}
}
Aggregations