Ejemplo n.º 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();
  }
Ejemplo n.º 2
0
 /**
  * Push the metric to the mr. The metric is pushed only if it was updated since last push
  *
  * <p>Note this does NOT push to JMX (JMX gets the info via {@link #get()}
  *
  * @param mr
  */
 public synchronized void pushMetric(final MetricsRecord mr) {
   if (changed) {
     try {
       mr.setMetric(getName(), value);
     } catch (Exception e) {
       LOG.info("pushMetric failed for " + getName() + "\n" + StringUtils.stringifyException(e));
     }
   }
   changed = false;
 }