Java Code Examples for org.apache.hadoop.metrics.util.MetricsTimeVaryingRate

The following examples show how to use org.apache.hadoop.metrics.util.MetricsTimeVaryingRate. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: hbase-indexer   Source File: SepMetrics.java    License: Apache License 2.0 5 votes vote down vote up
public SepMetrics(String recordName) {
    this.recordName = recordName;
    metricsRegistry = new MetricsRegistry();
    sepProcessingRate = new MetricsTimeVaryingRate("sepProcessed", metricsRegistry);
    lastTimestampInputProcessed = new MetricsLongValue("lastSepTimestamp", metricsRegistry);

    context = MetricsUtil.getContext("repository");
    metricsRecord = MetricsUtil.createRecord(context, recordName);
    context.registerUpdater(this);
    mbean = new SepMetricsMXBean(this.metricsRegistry);
}
 
Example 2
Source Project: RDFS   Source File: TaskTrackerMetricsInst.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public MetricsTimeVaryingRate getTaskLaunchMsecs() {
  return taskLaunchMsecs;
}
 
Example 3
Source Project: RDFS   Source File: MultiTaskTracker.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void doUpdates(MetricsContext context) {
  LOG.info("Updating metrics");
  int numTrackers = trackerList.size();
  long totalMapRefill = 0;
  long totalReduceRefill = 0;
  int totalRunningMaps = 0;
  int totalRunningReduces = 0;
  int totalMapSlots = 0;
  int totalReduceSlots = 0;
  for (TaskTracker tracker : trackerList) {
    totalMapRefill += tracker.getAveMapSlotRefillMsecs();
    totalReduceRefill += tracker.getAveReduceSlotRefillMsecs();
    totalRunningMaps += tracker.getRunningMaps();
    totalRunningReduces += tracker.getRunningReduces();
    totalMapSlots += tracker.getMaxActualMapTasks();
    totalReduceSlots += tracker.getMaxActualReduceTasks();

    // If the metrics exists, aggregate the task launch msecs for all
    // trackers
    TaskTrackerInstrumentation instrumentation =
        tracker.getTaskTrackerInstrumentation();
    if (instrumentation != null) {
      MetricsTimeVaryingRate taskLaunchMsecs =
          instrumentation.getTaskLaunchMsecs();
      if (taskLaunchMsecs != null) {
        taskLaunchMsecs.pushMetric(null);
        aggTaskLaunchMsecs.inc(
            taskLaunchMsecs.getPreviousIntervalAverageTime());
      }
    }
  }
  long avgMapRefill = totalMapRefill / numTrackers;
  long avgReduceRefill = totalReduceRefill / numTrackers;
  metricsRecord.setMetric("aveMapSlotRefillMsecs", avgMapRefill);
  metricsRecord.setMetric("aveReduceSlotRefillMsecs", avgReduceRefill);
  metricsRecord.setMetric("maps_running", totalRunningMaps);
  metricsRecord.setMetric("reduces_running", totalRunningReduces);
  metricsRecord.setMetric("mapTaskSlots", totalMapSlots);
  metricsRecord.setMetric("reduceTaskSlots", totalReduceSlots);

  for (MetricsBase metricsBase : registry.getMetricsList()) {
    metricsBase.pushMetric(metricsRecord);
  }

  metricsRecord.update();
}
 
Example 4
Source Project: RDFS   Source File: TaskTrackerInstrumentation.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Get the metrics for the task launch msecs.
 *
 * @return Metrics for task launch msecs.  Returns null if no such metric
 * exists.
 */
public MetricsTimeVaryingRate getTaskLaunchMsecs() {
  return null;
}