Java Code Examples for org.apache.hadoop.metrics.MetricsRecord#incrMetric()

The following examples show how to use org.apache.hadoop.metrics.MetricsRecord#incrMetric() . 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 File: ProxyJobTracker.java    From RDFS with Apache License 2.0 6 votes vote down vote up
private static void incrementMetricsAndReset(
  MetricsRecord record, Counters counters) {
  // Now update metrics with the counters and reset the aggregate.
  for (Counters.Group group : counters) {
    String groupName = group.getName();
    for (Counter counter : group) {
      String name = groupName + "_" + counter.getName();
      name = name.replaceAll("[^a-zA-Z_]", "_").toLowerCase();
      record.incrMetric(name, counter.getValue());
    }
  }
  // Reset the aggregate counters.
  for (Counters.Group g : counters) {
    for (Counter c : g) {
      c.setValue(0);
    }
  }
  record.update();
}
 
Example 2
Source File: MetricsTimeVaryingInt.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * Push the delta  metrics to the mr.
 * The delta is since the last push/interval.
 * 
 * Note this does NOT push to JMX
 * (JMX gets the info via {@link #previousIntervalValue}
 *
 * @param mr
 */
public void pushMetric(final MetricsRecord mr) {
  lock.lock();
  try {
    intervalHeartBeat();
    try {
      mr.incrMetric(getName(), getPreviousIntervalValue());
    } catch (Exception e) {
      LOG.info("pushMetric failed for " + getName() + "\n" +
          StringUtils.stringifyException(e));
    }
  } finally {
    lock.unlock();
  }
  
}
 
Example 3
Source File: MetricsTimeVaryingRate.java    From RDFS with Apache License 2.0 6 votes vote down vote up
/**
 * Push the delta  metrics to the mr.
 * The delta is since the last push/interval.
 * 
 * Note this does NOT push to JMX
 * (JMX gets the info via {@link #getPreviousIntervalAverageTime()} and
 * {@link #getPreviousIntervalNumOps()}
 *
 * @param mr metrics record.  If null, simply interval heart beat only.
 */
public void pushMetric(final MetricsRecord mr) {
  lock.lock();
  try {
    intervalHeartBeat();
    try {
      if (mr != null) {
        mr.incrMetric(getName() + "_num_ops", getPreviousIntervalNumOps());
        mr.setMetric(getName() + "_avg_time", getPreviousIntervalAverageTime());
        if (printMinMax) {
          mr.setMetric(getName() + "_min", getMinTime());
          mr.setMetric(getName() + "_max", getMaxTime());
          resetMinMax();
        }
      }
    } catch (Exception e) {
      LOG.info("pushMetric failed for " + getName() + "\n" +
          StringUtils.stringifyException(e));
    }
  } finally {
    lock.unlock();
  }
}
 
Example 4
Source File: JobStats.java    From RDFS with Apache License 2.0 5 votes vote down vote up
public synchronized void incrementMetricsAndReset(
  MetricsRecord  metricsRecord) {
  metricsRecord.incrMetric("maps_launched", getNumMapTasksLaunched());
  metricsRecord.incrMetric("maps_completed", getNumMapTasksCompleted());
  metricsRecord.incrMetric("maps_failed", getNumMapTasksFailed());
  metricsRecord.incrMetric("reduces_launched", getNumReduceTasksLaunched());
  metricsRecord.incrMetric("reduces_completed", getNumReduceTasksCompleted());
  metricsRecord.incrMetric("reduces_failed", getNumReduceTasksFailed());
  metricsRecord.incrMetric("num_speculative_maps", getNumSpeculativeMaps());
  metricsRecord.incrMetric("num_speculative_reduces", getNumSpeculativeReduces());
  metricsRecord.incrMetric("num_speculative_succeeded_maps",
    getNumSpeculativeSucceededMaps());
  metricsRecord.incrMetric("num_speculative_succeeded_reduces",
    getNumSpeculativeSucceededReduces());
  metricsRecord.incrMetric("num_speculative_wasted_maps",
    getNumSpeculativeWasteMaps());
  metricsRecord.incrMetric("num_speculative_wasted_reduces",
    getNumSpeculativeWasteReduces());
  metricsRecord.incrMetric("speculative_map_time_waste",
    getSpeculativeMapTimeWaste());
  metricsRecord.incrMetric("speculative_reduce_time_waste",
    getSpeculativeMapTimeWaste());
  metricsRecord.incrMetric("killed_tasks_map_time", getKilledMapTime());
  metricsRecord.incrMetric("killed_tasks_reduce_time", getKilledReduceTime());
  metricsRecord.incrMetric("failed_tasks_map_time", getFailedMapTime());
  metricsRecord.incrMetric("failed_tasks_reduce_time", getFailedReduceTime());
  metricsRecord.incrMetric("num_dataLocal_maps", getNumDataLocalMaps());
  metricsRecord.incrMetric("num_rackLocal_maps", getNumRackLocalMaps());
  metricsRecord.incrMetric("maps_killed", getNumMapTasksKilled());
  metricsRecord.incrMetric("reduces_killed", getNumReduceTasksKilled());
  metricsRecord.incrMetric("total_map_input_bytes", getTotalMapInputBytes());
  metricsRecord.incrMetric("local_map_input_bytes", getLocalMapInputBytes());
  metricsRecord.incrMetric("rack_map_input_bytes", getRackMapInputBytes());
  metricsRecord.incrMetric("maps_failed_by_fetch_failures",
    getNumMapTasksFailedByFetchFailures());
  metricsRecord.incrMetric("map_fetches_failed", getNumMapFetchFailures());

  reset();
}
 
Example 5
Source File: MetricsTimeVaryingLong.java    From RDFS with Apache License 2.0 5 votes vote down vote up
/**
 * Push the delta  metrics to the mr.
 * The delta is since the last push/interval.
 * 
 * Note this does NOT push to JMX
 * (JMX gets the info via {@link #previousIntervalValue}
 *
 * @param mr
 */
public void pushMetric(final MetricsRecord mr) {
  lock.lock();
  try {
    intervalHeartBeat();
    try {
      mr.incrMetric(getName(), getPreviousIntervalValue());
    } catch (Exception e) {
      LOG.info("pushMetric failed for " + getName() + "\n" +
          StringUtils.stringifyException(e));
    }
  } finally {
    lock.unlock();
  }
}
 
Example 6
Source File: MetricsTimeVaryingInt.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
/**
 * Push the delta  metrics to the mr.
 * The delta is since the last push/interval.
 * 
 * Note this does NOT push to JMX
 * (JMX gets the info via {@link #previousIntervalValue}
 *
 * @param mr
 */
public synchronized void pushMetric(final MetricsRecord mr) {
  intervalHeartBeat();
  try {
    mr.incrMetric(getName(), getPreviousIntervalValue());
  } catch (Exception e) {
    LOG.info("pushMetric failed for " + getName() + "\n" +
        StringUtils.stringifyException(e));
  }
}
 
Example 7
Source File: MetricsTimeVaryingLong.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
/**
 * Push the delta  metrics to the mr.
 * The delta is since the last push/interval.
 * 
 * Note this does NOT push to JMX
 * (JMX gets the info via {@link #previousIntervalValue}
 *
 * @param mr
 */
public synchronized void pushMetric(final MetricsRecord mr) {
  intervalHeartBeat();
  try {
    mr.incrMetric(getName(), getPreviousIntervalValue());
  } catch (Exception e) {
    LOG.info("pushMetric failed for " + getName() + "\n" +
        StringUtils.stringifyException(e));
  }
}
 
Example 8
Source File: MetricsTimeVaryingRate.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
/**
 * Push the delta  metrics to the mr.
 * The delta is since the last push/interval.
 * 
 * Note this does NOT push to JMX
 * (JMX gets the info via {@link #getPreviousIntervalAverageTime()} and
 * {@link #getPreviousIntervalNumOps()}
 *
 * @param mr
 */
public synchronized void pushMetric(final MetricsRecord mr) {
  intervalHeartBeat();
  try {
    mr.incrMetric(getName() + "_num_ops", getPreviousIntervalNumOps());
    mr.setMetric(getName() + "_avg_time", getPreviousIntervalAverageTime());
  } catch (Exception e) {
    LOG.info("pushMetric failed for " + getName() + "\n" +
        StringUtils.stringifyException(e));
  }
}
 
Example 9
Source File: MetricsTimeVaryingInt.java    From hadoop with Apache License 2.0 3 votes vote down vote up
/**
 * Push the delta  metrics to the mr.
 * The delta is since the last push/interval.
 * 
 * Note this does NOT push to JMX
 * (JMX gets the info via {@link #previousIntervalValue}
 *
 * @param mr
 */
public synchronized void pushMetric(final MetricsRecord mr) {
  intervalHeartBeat();
  try {
    mr.incrMetric(getName(), getPreviousIntervalValue());
  } catch (Exception e) {
    LOG.info("pushMetric failed for " + getName() + "\n" , e);
  }
}
 
Example 10
Source File: MetricsTimeVaryingLong.java    From hadoop with Apache License 2.0 3 votes vote down vote up
/**
 * Push the delta  metrics to the mr.
 * The delta is since the last push/interval.
 * 
 * Note this does NOT push to JMX
 * (JMX gets the info via {@link #previousIntervalValue}
 *
 * @param mr
 */
public synchronized void pushMetric(final MetricsRecord mr) {
  intervalHeartBeat();
  try {
    mr.incrMetric(getName(), getPreviousIntervalValue());
  } catch (Exception e) {
    LOG.info("pushMetric failed for " + getName() + "\n" , e);
  }
}
 
Example 11
Source File: MetricsTimeVaryingRate.java    From hadoop with Apache License 2.0 3 votes vote down vote up
/**
 * Push the delta  metrics to the mr.
 * The delta is since the last push/interval.
 * 
 * Note this does NOT push to JMX
 * (JMX gets the info via {@link #getPreviousIntervalAverageTime()} and
 * {@link #getPreviousIntervalNumOps()}
 *
 * @param mr
 */
public synchronized void pushMetric(final MetricsRecord mr) {
  intervalHeartBeat();
  try {
    mr.incrMetric(getName() + "_num_ops", getPreviousIntervalNumOps());
    mr.setMetric(getName() + "_avg_time", getPreviousIntervalAverageTime());
  } catch (Exception e) {
    LOG.info("pushMetric failed for " + getName() + "\n" , e);
  }
}
 
Example 12
Source File: MetricsTimeVaryingInt.java    From big-c with Apache License 2.0 3 votes vote down vote up
/**
 * Push the delta  metrics to the mr.
 * The delta is since the last push/interval.
 * 
 * Note this does NOT push to JMX
 * (JMX gets the info via {@link #previousIntervalValue}
 *
 * @param mr
 */
public synchronized void pushMetric(final MetricsRecord mr) {
  intervalHeartBeat();
  try {
    mr.incrMetric(getName(), getPreviousIntervalValue());
  } catch (Exception e) {
    LOG.info("pushMetric failed for " + getName() + "\n" , e);
  }
}
 
Example 13
Source File: MetricsTimeVaryingLong.java    From big-c with Apache License 2.0 3 votes vote down vote up
/**
 * Push the delta  metrics to the mr.
 * The delta is since the last push/interval.
 * 
 * Note this does NOT push to JMX
 * (JMX gets the info via {@link #previousIntervalValue}
 *
 * @param mr
 */
public synchronized void pushMetric(final MetricsRecord mr) {
  intervalHeartBeat();
  try {
    mr.incrMetric(getName(), getPreviousIntervalValue());
  } catch (Exception e) {
    LOG.info("pushMetric failed for " + getName() + "\n" , e);
  }
}
 
Example 14
Source File: MetricsTimeVaryingRate.java    From big-c with Apache License 2.0 3 votes vote down vote up
/**
 * Push the delta  metrics to the mr.
 * The delta is since the last push/interval.
 * 
 * Note this does NOT push to JMX
 * (JMX gets the info via {@link #getPreviousIntervalAverageTime()} and
 * {@link #getPreviousIntervalNumOps()}
 *
 * @param mr
 */
public synchronized void pushMetric(final MetricsRecord mr) {
  intervalHeartBeat();
  try {
    mr.incrMetric(getName() + "_num_ops", getPreviousIntervalNumOps());
    mr.setMetric(getName() + "_avg_time", getPreviousIntervalAverageTime());
  } catch (Exception e) {
    LOG.info("pushMetric failed for " + getName() + "\n" , e);
  }
}