Package org.apache.hadoop.metrics

Examples of org.apache.hadoop.metrics.MetricsContext


    }
  }

  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


  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));

    TEST_UTIL.startMiniZKCluster();
  }
View Full Code Here

public class HBaseRpcMetrics implements Updater {
  private MetricsRecord metricsRecord;
  private static Log LOG = LogFactory.getLog(HBaseRpcMetrics.class);
 
  public HBaseRpcMetrics(String hostName, String port, HBaseServer server) {
    MetricsContext context = MetricsUtil.getContext("rpc");
    metricsRecord = MetricsUtil.createRecord(context, "metrics");

    metricsRecord.setTag("port", port);

    LOG.info("Initializing RPC Metrics with hostName="
        + hostName + ", port=" + port);

    context.registerUpdater(this);
  }
View Full Code Here

   */
  public final MetricsIntValue memcacheSizeMB =
    new MetricsIntValue("hbase_memcacheSizeMB");

  public RegionServerMetrics() {
    MetricsContext context = MetricsUtil.getContext("hbase");
    metricsRecord = MetricsUtil.createRecord(context, "regionserver");
    String name = Thread.currentThread().getName();
    metricsRecord.setTag("RegionServer", name);
    context.registerUpdater(this);
    // Add jvmmetrics.
    JvmMetrics.init("RegionServer", name);
    LOG.info("Initialized");
  }
View Full Code Here

  public MetricsTimeVaryingInt httpTimeOutException =
    new MetricsTimeVaryingInt("httpTimeOutException", registry,"number of HTTP TimeOutException");
 
  /** Creates a new instance of HttpSenderMetrics */
  public HttpSenderMetrics(String processName, String recordName) {
      MetricsContext context = MetricsUtil.getContext(processName);
      metricsRecord = MetricsUtil.createRecord(context, recordName);
      metricsRecord.setTag("process", processName);
      mbean = new HttpSenderActivityMBean(registry, recordName);
      context.registerUpdater(this);
  }
View Full Code Here

  public MetricsTimeVaryingInt removedAdaptor =
    new MetricsTimeVaryingInt("removedAdaptor", registry,"number of removed adaptor");
 
  /** Creates a new instance of AgentMetrics */
  public AgentMetrics(String processName, String recordName) {
      MetricsContext context = MetricsUtil.getContext(processName);
      metricsRecord = MetricsUtil.createRecord(context, recordName);
      metricsRecord.setTag("process", processName);
      agentActivityMBean = new AgentActivityMBean(registry, recordName);
      context.registerUpdater(this);
     
  }
View Full Code Here

    new MetricsIntValue("fullQueue", registry,"Queue is full");
 
 
  /** Creates a new instance of QueueMetrics */
  public ChunkQueueMetrics(String processName, String recordName) {
      MetricsContext context = MetricsUtil.getContext(processName);
      metricsRecord = MetricsUtil.createRecord(context, recordName);
      mbean = new ChunkQueueActivityMBean(registry, recordName);
      context.registerUpdater(this);
     
  }
View Full Code Here

   */
  private final MetricsIntValue cluster_requests =
    new MetricsIntValue("cluster_requests");

  public MasterMetrics() {
    MetricsContext context = MetricsUtil.getContext("hbase");
    metricsRecord = MetricsUtil.createRecord(context, "master");
    String name = Thread.currentThread().getName();
    metricsRecord.setTag("Master", name);
    context.registerUpdater(this);
    JvmMetrics.init("Master", name);
    LOG.info("Initialized");
  }
View Full Code Here

        // Report back any failures, for diagnostic purposes
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        throwable.printStackTrace(new PrintStream(baos));
        umbilical.reportDiagnosticInfo(taskid, baos.toString());
      } finally {
        MetricsContext metricsContext = MetricsUtil.getContext("mapred");
        metricsContext.close();
        // Shutting down log4j of the child-vm...
        // This assumes that on return from Task.run()
        // there is no more logging done.
        LogManager.shutdown();
      }
View Full Code Here

      private int numFailedFetches = 0;
      private int numSuccessFetches = 0;
      private long numBytes = 0;
      private int numThreadsBusy = 0;
      ShuffleClientMetrics(JobConf conf) {
        MetricsContext metricsContext = MetricsUtil.getContext("mapred");
        this.shuffleMetrics =
          MetricsUtil.createRecord(metricsContext, "shuffleInput");
        this.shuffleMetrics.setTag("user", conf.getUser());
        this.shuffleMetrics.setTag("jobName", conf.getJobName());
        this.shuffleMetrics.setTag("jobId", ReduceTask.this.getJobId());
        this.shuffleMetrics.setTag("taskId", getTaskId());
        this.shuffleMetrics.setTag("sessionId", conf.getSessionId());
        metricsContext.registerUpdater(this);
      }
View Full Code Here

TOP

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

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.