Package org.apache.hadoop.metrics.spi

Examples of org.apache.hadoop.metrics.spi.OutputRecord


    MetricsContext context = factory.getContext("mapred");
    shuffleMetrics.doUpdates(context);
    Map<String, Collection<OutputRecord>> records = context.getAllRecords();
    Collection<OutputRecord> col = records.get("shuffleOutput");
    OutputRecord outputRecord = col.iterator().next();
    assertEquals(0, outputRecord.getMetric("shuffle_exceptions_caught")
        .intValue());

    // test with only MsgRegex set that does match
    ie = new IOException("Broken pipe");
    testServlet.checkException(ie, exceptionMsgRegex, exceptionStackRegex,
        shuffleMetrics);

    shuffleMetrics.doUpdates(context);
    assertEquals(1, outputRecord.getMetric("shuffle_exceptions_caught")
        .intValue());

    // test with neither set, make sure incremented
    exceptionStackRegex = null;
    exceptionMsgRegex = null;
    testServlet.checkException(ie, exceptionMsgRegex, exceptionStackRegex,
        shuffleMetrics);
    shuffleMetrics.doUpdates(context);
    assertEquals(2, outputRecord.getMetric("shuffle_exceptions_caught")
        .intValue());

    // test with only StackRegex set doesn't match
    exceptionStackRegex = ".*\\.doesnt\\$SelectSet\\.wakeup.*";
    exceptionMsgRegex = null;
    ie.setStackTrace(constructStackTrace());
    testServlet.checkException(ie, exceptionMsgRegex, exceptionStackRegex,
        shuffleMetrics);
    shuffleMetrics.doUpdates(context);
    assertEquals(2, outputRecord.getMetric("shuffle_exceptions_caught")
        .intValue());

    // test with only StackRegex set does match
    exceptionStackRegex = ".*\\.SelectorManager\\$SelectSet\\.wakeup.*";
    testServlet.checkException(ie, exceptionMsgRegex, exceptionStackRegex,
        shuffleMetrics);
    shuffleMetrics.doUpdates(context);
    assertEquals(3, outputRecord.getMetric("shuffle_exceptions_caught")
        .intValue());

    // test with both regex set and matches
    exceptionMsgRegex = "Broken pipe";
    ie.setStackTrace(constructStackTraceTwo());
    testServlet.checkException(ie, exceptionMsgRegex, exceptionStackRegex,
        shuffleMetrics);
    shuffleMetrics.doUpdates(context);
    assertEquals(4, outputRecord.getMetric("shuffle_exceptions_caught")
        .intValue());

    // test with both regex set and only msg matches
    exceptionStackRegex = ".*[1-9]+BOGUSREGEX";
    testServlet.checkException(ie, exceptionMsgRegex, exceptionStackRegex,
        shuffleMetrics);
    shuffleMetrics.doUpdates(context);
    assertEquals(4, outputRecord.getMetric("shuffle_exceptions_caught")
        .intValue());

    // test with both regex set and only stack matches
    exceptionStackRegex = ".*\\.SelectorManager\\$SelectSet\\.wakeup.*";
    exceptionMsgRegex = "EOFException";
    testServlet.checkException(ie, exceptionMsgRegex, exceptionStackRegex,
        shuffleMetrics);
    shuffleMetrics.doUpdates(context);
    assertEquals(4, outputRecord.getMetric("shuffle_exceptions_caught")
        .intValue());
  }
View Full Code Here


  private static void verifyMetrics(ThriftMetrics metrics, String name, int expectValue)
      throws Exception {
    MetricsContext context = MetricsUtil.getContext(
        ThriftMetrics.CONTEXT_NAME);
    metrics.doUpdates(context);
    OutputRecord record = context.getAllRecords().get(
        ThriftMetrics.CONTEXT_NAME).iterator().next();
    assertEquals(expectValue, record.getMetric(name).intValue());
  }
View Full Code Here

  private static void verifyMetrics(ThriftMetrics metrics, String name, int expectValue)
      throws Exception {
    MetricsContext context = MetricsUtil.getContext(
        ThriftMetrics.CONTEXT_NAME);
    metrics.doUpdates(context);
    OutputRecord record = context.getAllRecords().get(
        ThriftMetrics.CONTEXT_NAME).iterator().next();
    assertEquals(expectValue, record.getMetric(name).intValue());
  }
View Full Code Here

    poolScheds.addAll(scheduler.getPoolSchedulables(TaskType.MAP));
    poolScheds.addAll(scheduler.getPoolSchedulables(TaskType.REDUCE));
   
    for (PoolSchedulable pool : poolScheds) {
      String poolName = pool.getName();
      OutputRecord metrics = byPoolAndType.get(
          poolName + "_" + pool.getTaskType().toString());
      assertNotNull("Need metrics for " + pool, metrics);
     
      verifySchedulableMetrics(pool, metrics);
    }
View Full Code Here

    for (Map.Entry<JobInProgress, JobInfo> entry :
            scheduler.infos.entrySet()) {
      JobInfo info = entry.getValue();
      String jobId = entry.getKey().getJobID().toString();
     
      OutputRecord mapMetrics = byJobIdAndType.get(jobId + "_MAP");
      assertNotNull("Job " + jobId + " should have map metrics", mapMetrics);
      verifySchedulableMetrics(info.mapSchedulable, mapMetrics);
     
      OutputRecord reduceMetrics = byJobIdAndType.get(jobId + "_REDUCE");
      assertNotNull("Job " + jobId + " should have reduce metrics", reduceMetrics);
      verifySchedulableMetrics(info.reduceSchedulable, reduceMetrics);
    }
  }
View Full Code Here

    poolScheds.addAll(scheduler.getPoolSchedulables(TaskType.MAP));
    poolScheds.addAll(scheduler.getPoolSchedulables(TaskType.REDUCE));
   
    for (PoolSchedulable pool : poolScheds) {
      String poolName = pool.getName();
      OutputRecord metrics = byPoolAndType.get(
          poolName + "_" + pool.getTaskType().toString());
      assertNotNull("Need metrics for " + pool, metrics);
     
      verifySchedulableMetrics(pool, metrics);
    }
View Full Code Here

    for (Map.Entry<JobInProgress, JobInfo> entry :
            scheduler.infos.entrySet()) {
      JobInfo info = entry.getValue();
      String jobId = entry.getKey().getJobID().toString();
     
      OutputRecord mapMetrics = byJobIdAndType.get(jobId + "_MAP");
      assertNotNull("Job " + jobId + " should have map metrics", mapMetrics);
      verifySchedulableMetrics(info.mapSchedulable, mapMetrics);
     
      OutputRecord reduceMetrics = byJobIdAndType.get(jobId + "_REDUCE");
      assertNotNull("Job " + jobId + " should have reduce metrics", reduceMetrics);
      verifySchedulableMetrics(info.reduceSchedulable, reduceMetrics);
    }
  }
View Full Code Here

  private static void verifyMetrics(ThriftMetrics metrics, String name, int expectValue)
      throws Exception {
    MetricsContext context = MetricsUtil.getContext(
        ThriftMetrics.CONTEXT_NAME);
    metrics.doUpdates(context);
    OutputRecord record = context.getAllRecords().get(
        ThriftMetrics.CONTEXT_NAME).iterator().next();
    assertEquals(expectValue, record.getMetric(name).intValue());
  }
View Full Code Here

  private void verifyMetrics(String name, int expectValue) throws Exception {
    MetricsContext context = MetricsUtil.getContext(
        ClusterManagerMetrics.CONTEXT_NAME);
    cm.metrics.doUpdates(context);
    OutputRecord record = context.getAllRecords().get(
        ClusterManagerMetrics.CONTEXT_NAME).iterator().next();
    Assert.assertEquals(expectValue, record.getMetric(name).intValue());
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.metrics.spi.OutputRecord

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.