本文整理汇总了Java中org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry类的典型用法代码示例。如果您正苦于以下问题:Java DynamicMetricsRegistry类的具体用法?Java DynamicMetricsRegistry怎么用?Java DynamicMetricsRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DynamicMetricsRegistry类属于org.apache.hadoop.metrics2.lib包,在下文中一共展示了DynamicMetricsRegistry类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BaseSourceImpl
import org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry; //导入依赖的package包/类
public BaseSourceImpl(
String metricsName,
String metricsDescription,
String metricsContext,
String metricsJmxContext) {
this.metricsName = metricsName;
this.metricsDescription = metricsDescription;
this.metricsContext = metricsContext;
this.metricsJmxContext = metricsJmxContext;
metricsRegistry = new DynamicMetricsRegistry(metricsName).setContext(metricsContext);
DefaultMetricsSystemInitializer.INSTANCE.init(metricsName);
//Register this instance.
DefaultMetricsSystem.instance().register(metricsJmxContext, metricsDescription, this);
init();
}
示例2: BaseSourceImpl
import org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry; //导入依赖的package包/类
public BaseSourceImpl(
String metricsName,
String metricsDescription,
String metricsContext,
String metricsJmxContext) {
this.metricsName = metricsName;
this.metricsDescription = metricsDescription;
this.metricsContext = metricsContext;
this.metricsJmxContext = metricsJmxContext;
metricsRegistry = new DynamicMetricsRegistry(metricsName).setContext(metricsContext);
DefaultMetricsSystemInitializer.INSTANCE.init(metricsName);
//Register this instance.
DefaultMetricsSystem.instance().register(metricsJmxContext, metricsDescription, this);
// hbase-metrics module based metrics are registered in the hbase MetricsRegistry.
registry = MetricRegistries.global().create(this.getMetricRegistryInfo());
metricsAdapter = new HBaseMetrics2HadoopMetricsAdapter();
init();
}
示例3: TableHistograms
import org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry; //导入依赖的package包/类
TableHistograms(DynamicMetricsRegistry registry, TableName tn) {
getTimeHisto = registry.newTimeHistogram(qualifyMetricsName(tn, GET_TIME));
incrementTimeHisto = registry.newTimeHistogram(
qualifyMetricsName(tn, INCREMENT_TIME));
appendTimeHisto = registry.newTimeHistogram(qualifyMetricsName(tn, APPEND_TIME));
putTimeHisto = registry.newTimeHistogram(qualifyMetricsName(tn, PUT_TIME));
putBatchTimeHisto = registry.newTimeHistogram(qualifyMetricsName(tn, PUT_BATCH_TIME));
deleteTimeHisto = registry.newTimeHistogram(qualifyMetricsName(tn, DELETE_TIME));
deleteBatchTimeHisto = registry.newTimeHistogram(
qualifyMetricsName(tn, DELETE_BATCH_TIME));
scanTimeHisto = registry.newTimeHistogram(qualifyMetricsName(tn, SCAN_TIME));
scanSizeHisto = registry.newSizeHistogram(qualifyMetricsName(tn, SCAN_SIZE));
}
示例4: getMetricsRegistry
import org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry; //导入依赖的package包/类
public DynamicMetricsRegistry getMetricsRegistry() {
return metricsRegistry;
}
示例5: testMetricsSourceBaseSourcePassthrough
import org.apache.hadoop.metrics2.lib.DynamicMetricsRegistry; //导入依赖的package包/类
@Test
public void testMetricsSourceBaseSourcePassthrough(){
/*
The replication MetricsSource wraps a MetricsReplicationSourceSourceImpl
and a MetricsReplicationGlobalSourceSource, so that metrics get written to both namespaces.
Both of those classes wrap a MetricsReplicationSourceImpl that implements BaseSource, which
allows for custom JMX metrics.
This test checks to make sure the BaseSource decorator logic on MetricsSource actually calls down through
the two layers of wrapping to the actual BaseSource.
*/
String id = "id";
DynamicMetricsRegistry mockRegistry = mock(DynamicMetricsRegistry.class);
MetricsReplicationSourceImpl singleRms = mock(MetricsReplicationSourceImpl.class);
when(singleRms.getMetricsRegistry()).thenReturn(mockRegistry);
MetricsReplicationSourceImpl globalRms = mock(MetricsReplicationSourceImpl.class);
when(globalRms.getMetricsRegistry()).thenReturn(mockRegistry);
MetricsReplicationSourceSource singleSourceSource = new MetricsReplicationSourceSourceImpl(singleRms, id);
MetricsReplicationSourceSource globalSourceSource = new MetricsReplicationGlobalSourceSource(globalRms);
MetricsSource source = new MetricsSource(id, singleSourceSource, globalSourceSource);
String gaugeName = "gauge";
String singleGaugeName = "source.id." + gaugeName;
String globalGaugeName = "source." + gaugeName;
long delta = 1;
String counterName = "counter";
String singleCounterName = "source.id." + counterName;
String globalCounterName = "source." + counterName;
long count = 2;
source.decGauge(gaugeName, delta);
source.getMetricsContext();
source.getMetricsDescription();
source.getMetricsJmxContext();
source.getMetricsName();
source.incCounters(counterName, count);
source.incGauge(gaugeName, delta);
source.init();
source.removeMetric(gaugeName);
source.setGauge(gaugeName, delta);
source.updateHistogram(counterName, count);
verify(singleRms).decGauge(singleGaugeName, delta);
verify(globalRms).decGauge(globalGaugeName, delta);
verify(globalRms).getMetricsContext();
verify(globalRms).getMetricsJmxContext();
verify(globalRms).getMetricsName();
verify(singleRms).incCounters(singleCounterName, count);
verify(globalRms).incCounters(globalCounterName, count);
verify(singleRms).incGauge(singleGaugeName, delta);
verify(globalRms).incGauge(globalGaugeName, delta);
verify(globalRms).init();
verify(singleRms).removeMetric(singleGaugeName);
verify(globalRms).removeMetric(globalGaugeName);
verify(singleRms).setGauge(singleGaugeName, delta);
verify(globalRms).setGauge(globalGaugeName, delta);
verify(singleRms).updateHistogram(singleCounterName, count);
verify(globalRms).updateHistogram(globalCounterName, count);
}