Java 类org.apache.hadoop.hbase.replication.regionserver.MetricsSource 实例源码

项目:ditb    文件:ReplicationEndpoint.java   
@InterfaceAudience.Private
public Context(
    final Configuration conf,
    final FileSystem fs,
    final ReplicationPeerConfig peerConfig,
    final String peerId,
    final UUID clusterId,
    final ReplicationPeer replicationPeer,
    final MetricsSource metrics,
    final TableDescriptors tableDescriptors) {
  this.peerConfig = peerConfig;
  this.conf = conf;
  this.fs = fs;
  this.clusterId = clusterId;
  this.peerId = peerId;
  this.replicationPeer = replicationPeer;
  this.metrics = metrics;
  this.tableDescriptors = tableDescriptors;
}
项目:pbase    文件:ReplicationEndpoint.java   
@InterfaceAudience.Private
public Context(
    final Configuration conf,
    final FileSystem fs,
    final ReplicationPeerConfig peerConfig,
    final String peerId,
    final UUID clusterId,
    final ReplicationPeer replicationPeer,
    final MetricsSource metrics) {
  this.peerConfig = peerConfig;
  this.conf = conf;
  this.fs = fs;
  this.clusterId = clusterId;
  this.peerId = peerId;
  this.replicationPeer = replicationPeer;
  this.metrics = metrics;
}
项目:hbase    文件:ReplicationEndpoint.java   
@InterfaceAudience.Private
public Context(
    final Configuration localConf,
    final Configuration conf,
    final FileSystem fs,
    final String peerId,
    final UUID clusterId,
    final ReplicationPeer replicationPeer,
    final MetricsSource metrics,
    final TableDescriptors tableDescriptors,
    final Abortable abortable) {
  this.localConf = localConf;
  this.conf = conf;
  this.fs = fs;
  this.clusterId = clusterId;
  this.peerId = peerId;
  this.replicationPeer = replicationPeer;
  this.metrics = metrics;
  this.tableDescriptors = tableDescriptors;
  this.abortable = abortable;
}
项目:ditb    文件:ReplicationSourceDummy.java   
@Override
public void init(Configuration conf, FileSystem fs, ReplicationSourceManager manager,
    ReplicationQueues rq, ReplicationPeers rp, Stoppable stopper, String peerClusterId,
    UUID clusterId, ReplicationEndpoint replicationEndpoint, MetricsSource metrics)
        throws IOException {

  this.manager = manager;
  this.peerClusterId = peerClusterId;
}
项目:pbase    文件:ReplicationSourceDummy.java   
@Override
public void init(Configuration conf, FileSystem fs, ReplicationSourceManager manager,
    ReplicationQueues rq, ReplicationPeers rp, Stoppable stopper, String peerClusterId,
    UUID clusterId, ReplicationEndpoint replicationEndpoint, MetricsSource metrics)
        throws IOException {

  this.manager = manager;
  this.peerClusterId = peerClusterId;
}
项目:hbase    文件:ReplicationSourceDummy.java   
@Override
public void init(Configuration conf, FileSystem fs, ReplicationSourceManager manager,
    ReplicationQueueStorage rq, ReplicationPeer rp, Server server, String peerClusterId,
    UUID clusterId, WALFileLengthProvider walFileLengthProvider, MetricsSource metrics)
    throws IOException {
  this.manager = manager;
  this.peerClusterId = peerClusterId;
  this.metrics = metrics;
  this.walFileLengthProvider = walFileLengthProvider;
}
项目:ditb    文件:ReplicationEndpoint.java   
public MetricsSource getMetrics() {
  return metrics;
}
项目:pbase    文件:ReplicationEndpoint.java   
public MetricsSource getMetrics() {
  return metrics;
}
项目:hbase    文件:ReplicationEndpoint.java   
public MetricsSource getMetrics() {
  return metrics;
}
项目:hbase    文件:TestReplicationEndpoint.java   
@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);
}
项目:hbase    文件:ReplicationSourceDummy.java   
@Override
public MetricsSource getSourceMetrics() {
  return metrics;
}