Package org.apache.hadoop.metrics2

Examples of org.apache.hadoop.metrics2.MetricsRecordBuilder


 
  public static void verifyLoginMetrics(int success, int failure)
      throws IOException {
    // Ensure metrics related to kerberos login is updated.
    UgiInstrumentation metrics = UserGroupInformation.metrics;
    MetricsRecordBuilder rb = getMetrics(metrics);

    if (success > 0) {
      assertCounter("loginSuccess_num_ops", success, rb);
      assertGaugeGt("loginSuccess_avg_time", 0, rb);
    }
View Full Code Here


        --threadsBusy;
      }

      @Override
      public void getMetrics(MetricsBuilder builder, boolean all) {
        MetricsRecordBuilder rb = builder.addRecord(registry.name());
        rb.addGauge("shuffle_fetchers_busy_percent", "", numCopiers == 0 ? 0
            : 100. * threadsBusy / numCopiers);
        registry.snapshot(rb, all);
      }
View Full Code Here

  /**
   * Test that capacity metrics are exported and pass
   * basic sanity tests.
   */
  public void testCapacityMetrics() throws Exception {
    MetricsRecordBuilder rb = getMetrics(fsnMetrics);
    long capacityTotal = getLongGauge("CapacityTotal", rb);
    assert(capacityTotal != 0);
    long capacityUsed = getLongGauge("CapacityUsed", rb);
    long capacityRemaining =
        getLongGauge("CapacityRemaining", rb);
View Full Code Here

    updateMetrics();
    assertGauge("BlockCapacity", blockCapacity, fsnMetrics);
   
    // File create operations is 1
    // Number of files created is depth of <code>file</code> path
    MetricsRecordBuilder rb = getMetrics(nnMetrics);
    assertCounter("CreateFileOps", 1, rb);
    assertCounter("FilesCreated", file.depth(), rb);

    // Blocks are stored in a hashmap. Compute its capacity, which
    // doubles every time the number of entries reach the threshold.
View Full Code Here

   
    // Corrupt first replica of the block
    LocatedBlock block = namesystem.getBlockLocations(file.toString(), 0, 1).get(0);
    namesystem.markBlockAsCorrupt(block.getBlock(), block.getLocations()[0]);
    updateMetrics();
    MetricsRecordBuilder rb = getMetrics(fsnMetrics);
    assertGauge("CorruptBlocks", 1L, rb);
    assertGauge("PendingReplicationBlocks", 1L, rb);
    assertGauge("ScheduledReplicationBlocks", 1L, rb);
    fs.delete(file, true);
    updateMetrics();
View Full Code Here

   
    // Corrupt the only replica of the block to result in a missing block
    LocatedBlock block = namesystem.getBlockLocations(file.toString(), 0, 1).get(0);
    namesystem.markBlockAsCorrupt(block.getBlock(), block.getLocations()[0]);
    updateMetrics();
    MetricsRecordBuilder rb = getMetrics(fsnMetrics);
    assertGauge("UnderReplicatedBlocks", 1L, rb);
    assertGauge("MissingBlocks", 1L, rb);
    fs.delete(file, true);
    updateMetrics();
    assertGauge("UnderReplicatedBlocks", 0L, fsnMetrics);
View Full Code Here

    jn.stop(0);
  }
 
  @Test(timeout=100000)
  public void testJournal() throws Exception {
    MetricsRecordBuilder metrics = MetricsAsserts.getMetrics(
        journal.getMetricsForTests().getName());
    MetricsAsserts.assertCounter("BatchesWritten", 0L, metrics);
    MetricsAsserts.assertCounter("BatchesWrittenWhileLagging", 0L, metrics);
    MetricsAsserts.assertGauge("CurrentLagTxns", 0L, metrics);
View Full Code Here

    long cacheUsed = fsd.getCacheUsed();
    long current = 0;
    assertEquals("Unexpected cache capacity", CACHE_CAPACITY, cacheCapacity);
    assertEquals("Unexpected amount of cache used", current, cacheUsed);

    MetricsRecordBuilder dnMetrics;
    long numCacheCommands = 0;
    long numUncacheCommands = 0;

    // Cache each block in succession, checking each time
    for (int i=0; i<NUM_BLOCKS; i++) {
View Full Code Here

    dfs.addCacheDirective(new CacheDirectiveInfo.Builder()
        .setPool("pool").setPath(fileName).setReplication((short)3).build());
    GenericTestUtils.waitFor(new Supplier<Boolean>() {
      @Override
      public Boolean get() {
        MetricsRecordBuilder dnMetrics = getMetrics(dn.getMetrics().name());
        long blocksCached =
            MetricsAsserts.getLongCounter("BlocksCached", dnMetrics);
        return blocksCached > 0;
      }
    }, 1000, 30000);
    // Uncache it
    dfs.removeCacheDirective(1);
    GenericTestUtils.waitFor(new Supplier<Boolean>() {
      @Override
      public Boolean get() {
        MetricsRecordBuilder dnMetrics = getMetrics(dn.getMetrics().name());
        long blocksUncached =
            MetricsAsserts.getLongCounter("BlocksUncached", dnMetrics);
        return blocksUncached > 0;
      }
    }, 1000, 30000);
    // Make sure that no additional messages were sent
    Thread.sleep(10000);
    MetricsRecordBuilder dnMetrics = getMetrics(dn.getMetrics().name());
    MetricsAsserts.assertCounter("BlocksCached", 1l, dnMetrics);
    MetricsAsserts.assertCounter("BlocksUncached", 1l, dnMetrics);
  }
View Full Code Here

      // Take a checkpoint
      //
      secondary = startSecondaryNameNode(conf);
      secondary.doCheckpoint();

      MetricsRecordBuilder rb = getMetrics(NN_METRICS);
      assertCounterGt("GetImageNumOps", 0, rb);
      assertCounterGt("GetEditNumOps", 0, rb);
      assertCounterGt("PutImageNumOps", 0, rb);
      assertGaugeGt("GetImageAvgTime", 0.0, rb);
      assertGaugeGt("GetEditAvgTime", 0.0, rb);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.metrics2.MetricsRecordBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.