Package org.apache.hadoop.metrics

Examples of org.apache.hadoop.metrics.ContextFactory


  private static Log LOG = LogFactory.getLog(TestRpcMetrics.class);

  @BeforeClass
  public static void setupBeforeClass() throws Exception {
    // set custom metrics context
    ContextFactory factory = ContextFactory.getFactory();
    factory.setAttribute("rpc.class", MockMetricsContext.class.getName());
    // make sure metrics context is setup, otherwise updating won't start
    MetricsContext ctx = MetricsUtil.getContext("rpc");
    assertTrue("Wrong MetricContext implementation class",
        (ctx instanceof MockMetricsContext));
View Full Code Here


    setupMetricsContext();
    return new ThriftMetrics(ThriftServerRunner.DEFAULT_LISTEN_PORT, conf, Hbase.Iface.class);
  }

  private static void setupMetricsContext() throws IOException {
    ContextFactory factory = ContextFactory.getFactory();
    factory.setAttribute(ThriftMetrics.CONTEXT_NAME + ".class",
        NoEmitMetricsContext.class.getName());
    MetricsUtil.getContext(ThriftMetrics.CONTEXT_NAME)
               .createRecord(ThriftMetrics.CONTEXT_NAME).remove();
  }
View Full Code Here

  private static Log LOG = LogFactory.getLog(TestRpcMetrics.class);

  @BeforeClass
  public static void setupBeforeClass() throws Exception {
    // set custom metrics context
    ContextFactory factory = ContextFactory.getFactory();
    factory.setAttribute("rpc.class", MockMetricsContext.class.getName());
    // make sure metrics context is setup, otherwise updating won't start
    MetricsContext ctx = MetricsUtil.getContext("rpc");
    assertTrue("Wrong MetricContext implementation class",
        (ctx instanceof MockMetricsContext));
View Full Code Here

    return new ThriftMetrics(Integer.parseInt(ThriftServer.DEFAULT_LISTEN_PORT),
        conf, THBaseService.Iface.class);
  }
  private static void setupMetricsContext() throws IOException {
    ContextFactory factory = ContextFactory.getFactory();
    factory.setAttribute(ThriftMetrics.CONTEXT_NAME + ".class",
        NoEmitMetricsContext.class.getName());
    MetricsUtil.getContext(ThriftMetrics.CONTEXT_NAME)
               .createRecord(ThriftMetrics.CONTEXT_NAME).remove();
  }
View Full Code Here

    conf.setUser("testuser");
    conf.setJobName("testJob");
    conf.setSessionId("testSession");

    // setup metrics context factory
    ContextFactory factory = ContextFactory.getFactory();
    factory.setAttribute("mapred.class",
        "org.apache.hadoop.metrics.spi.NoEmitMetricsContext");

    TaskTracker tt = new TaskTracker();
    tt.setConf(conf);
    ShuffleServerMetrics shuffleMetrics = tt.new ShuffleServerMetrics(conf);

    // first test with only MsgRegex set but doesn't match
    String exceptionMsgRegex = "Broken pipe";
    String exceptionStackRegex = null;
    IOException ie = new IOException("EOFException");
    testServlet.checkException(ie, exceptionMsgRegex, exceptionStackRegex,
        shuffleMetrics);

    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")
View Full Code Here

    return new ThriftMetrics(
        ThriftServerRunner.DEFAULT_LISTEN_PORT, conf, Hbase.Iface.class);
  }

  private static void setupMetricsContext() throws Exception {
    ContextFactory factory = ContextFactory.getFactory();
    factory.setAttribute(ThriftMetrics.CONTEXT_NAME + ".class",
        NoEmitMetricsContext.class.getName());
    MetricsUtil.getContext(ThriftMetrics.CONTEXT_NAME)
               .createRecord(ThriftMetrics.CONTEXT_NAME).remove();
  }
View Full Code Here

    setupMetricsContext();
    return new ThriftMetrics(ThriftServerRunner.DEFAULT_LISTEN_PORT, conf, Hbase.Iface.class);
  }

  private static void setupMetricsContext() throws IOException {
    ContextFactory factory = ContextFactory.getFactory();
    factory.setAttribute(ThriftMetrics.CONTEXT_NAME + ".class",
        NoEmitMetricsContext.class.getName());
    MetricsUtil.getContext(ThriftMetrics.CONTEXT_NAME)
               .createRecord(ThriftMetrics.CONTEXT_NAME).remove();
  }
View Full Code Here

   * Set up a metrics context that doesn't emit anywhere but stores the data
   * so we can verify it. Also clears it of any data so that different test
   * cases don't pollute each other.
   */
  private void resetMetrics() throws IOException {
    ContextFactory factory = ContextFactory.getFactory();
    factory.setAttribute("fairscheduler.class",
        NoEmitMetricsContext.class.getName());
   
    MetricsUtil.getContext("fairscheduler").createRecord("jobs").remove();
    MetricsUtil.getContext("fairscheduler").createRecord("pools").remove();
  }
View Full Code Here

   * Set up a metrics context that doesn't emit anywhere but stores the data
   * so we can verify it. Also clears it of any data so that different test
   * cases don't pollute each other.
   */
  private void resetMetrics() throws IOException {
    ContextFactory factory = ContextFactory.getFactory();
    factory.setAttribute("fairscheduler.class",
        NoEmitMetricsContext.class.getName());
   
    MetricsUtil.getContext("fairscheduler").createRecord("jobs").remove();
    MetricsUtil.getContext("fairscheduler").createRecord("pools").remove();
  }
View Full Code Here

    return new ThriftMetrics(Integer.parseInt(ThriftServer.DEFAULT_LISTEN_PORT),
        conf, THBaseService.Iface.class);
  }
  private static void setupMetricsContext() throws IOException {
    ContextFactory factory = ContextFactory.getFactory();
    factory.setAttribute(ThriftMetrics.CONTEXT_NAME + ".class",
        NoEmitMetricsContext.class.getName());
    MetricsUtil.getContext(ThriftMetrics.CONTEXT_NAME)
               .createRecord(ThriftMetrics.CONTEXT_NAME).remove();
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.metrics.ContextFactory

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.