@Test
  public void testWrapperSource() {
    MetricsHBaseServer mrpc =
      new MetricsHBaseServer("HMaster", new MetricsHBaseServerWrapperStub());
    MetricsHBaseServerSource serverSource = mrpc.getMetricsSource();
    HELPER.assertGauge("queueSize", 101, serverSource);
    HELPER.assertGauge("numCallsInGeneralQueue", 102, serverSource);
    HELPER.assertGauge("numCallsInReplicationQueue", 103, serverSource);
    HELPER.assertGauge("numCallsInPriorityQueue", 104, serverSource);
    HELPER.assertGauge("numOpenConnections", 105, serverSource);
    HELPER.assertGauge("numActiveHandler", 106, serverSource);
    HELPER.assertGauge("numActiveGeneralHandler", 201, serverSource);
    HELPER.assertGauge("numActivePriorityHandler", 202, serverSource);
    HELPER.assertGauge("numActiveReplicationHandler", 203, serverSource);
    HELPER.assertGauge("numActiveWriteHandler", 50, serverSource);
    HELPER.assertGauge("numActiveReadHandler", 50, serverSource);
    HELPER.assertGauge("numActiveScanHandler", 6, serverSource);
    HELPER.assertGauge("numCallsInWriteQueue", 50, serverSource);
    HELPER.assertGauge("numCallsInReadQueue", 50, serverSource);
    HELPER.assertGauge("numCallsInScanQueue", 2, serverSource);
    HELPER.assertGauge("nettyDirectMemoryUsage", 100, serverSource);
    HELPER.assertGauge("nettyTotalPendingOutboundBytes", 100, serverSource);
    HELPER.assertGauge("nettyMaxPendingOutboundBytes", 5, serverSource);
  }
This test makes sure that the numbers from a MetricsHBaseServerWrapper are correctly exported
to hadoop metrics 2 system.
hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/TestRpcMetrics.java