コード例 #1
0
  /**
   * Since this object is a registered updater, this method will be called periodically, e.g. every
   * 5 seconds.
   */
  public void doUpdates(MetricsContext unused) {
    synchronized (this) {
      metricsRecord.setMetric("maps_running", tt.mapTotal);
      metricsRecord.setMetric("reduces_running", tt.reduceTotal);
      metricsRecord.setMetric("mapTaskSlots", (short) tt.getMaxCurrentMapTasks());
      metricsRecord.setMetric("reduceTaskSlots", (short) tt.getMaxCurrentReduceTasks());
      metricsRecord.incrMetric("tasks_completed", numCompletedTasks);
      metricsRecord.incrMetric("tasks_failed_timeout", timedoutTasks);
      metricsRecord.incrMetric("tasks_failed_ping", tasksFailedPing);

      numCompletedTasks = 0;
      timedoutTasks = 0;
      tasksFailedPing = 0;
    }
    metricsRecord.update();
  }
コード例 #2
0
 /**
  * Push the delta metrics to the mr. The delta is since the last push/interval.
  *
  * <p>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);
   }
 }