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

The following examples show how to use org.apache.hadoop.metrics.MetricsRecord#setMetric() . 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: FairSchedulerMetricsInst.java    From RDFS with Apache License 2.0 6 votes vote down vote up
private void submitPoolMetrics(PoolInfo info) {
  MetricsRecord record = poolToMetricsRecord.get(info.poolName);
  if (record == null) {
    record = MetricsUtil.createRecord(context, "pool-" + info.poolName);
    FairScheduler.LOG.info("Create metrics record for pool:" + info.poolName);
    poolToMetricsRecord.put(info.poolName, record);
  }
  record.setMetric("min_map", info.minMaps);
  record.setMetric("min_reduce", info.minReduces);
  record.setMetric("max_map", info.maxMaps);
  record.setMetric("max_reduce", info.maxReduces);
  record.setMetric("running_map", info.runningMaps);
  record.setMetric("running_reduce", info.runningReduces);
  record.setMetric("runnable_map", info.runnableMaps);
  record.setMetric("runnable_reduce", info.runnableReduces);
  record.setMetric("inited_tasks", info.initedTasks);
  record.setMetric("max_inited_tasks", info.maxInitedTasks);
  int runningJobs = info.runningJobs;
  record.setMetric("avg_first_map_wait_ms",
      (runningJobs == 0) ? 0 : info.totalFirstMapWaitTime / runningJobs);
  record.setMetric("avg_first_reduce_wait_ms",
      (runningJobs == 0) ? 0 : info.totalFirstReduceWaitTime / runningJobs);
}
 
Example 2
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 3
Source File: MetricsIntValue.java    From hadoop with Apache License 2.0 5 votes vote down vote up
/**
 * Push the metric to the mr.
 * The metric is pushed only if it was updated since last push
 * 
 * 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", e);
    }
  }
  changed = false;
}
 
Example 4
Source File: MetricsIntValue.java    From big-c with Apache License 2.0 5 votes vote down vote up
/**
 * Push the metric to the mr.
 * The metric is pushed only if it was updated since last push
 * 
 * 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", e);
    }
  }
  changed = false;
}
 
Example 5
Source File: MetricsIntValue.java    From RDFS with Apache License 2.0 5 votes vote down vote up
/**
 * Push the metric to the mr.
 * The metric is pushed only if it was updated since last push
 * 
 * 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;
}
 
Example 6
Source File: MetricsIntValue.java    From hadoop-gpu with Apache License 2.0 5 votes vote down vote up
/**
 * Push the metric to the mr.
 * The metric is pushed only if it was updated since last push
 * 
 * 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;
}
 
Example 7
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 8
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 9
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);
  }
}
 
Example 10
Source File: MetricsLongValue.java    From hadoop with Apache License 2.0 2 votes vote down vote up
/**
 * Push the metric to the mr.
 * The metric is pushed only if it was updated since last push
 * 
 * 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) 
    mr.setMetric(getName(), value);
  changed = false;
}
 
Example 11
Source File: MetricsLongValue.java    From big-c with Apache License 2.0 2 votes vote down vote up
/**
 * Push the metric to the mr.
 * The metric is pushed only if it was updated since last push
 * 
 * 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) 
    mr.setMetric(getName(), value);
  changed = false;
}
 
Example 12
Source File: MetricsLongValue.java    From RDFS with Apache License 2.0 2 votes vote down vote up
/**
 * Push the metric to the mr.
 * The metric is pushed only if it was updated since last push
 * 
 * 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) 
    mr.setMetric(getName(), value);
  changed = false;
}
 
Example 13
Source File: MetricsLongValue.java    From hadoop-gpu with Apache License 2.0 2 votes vote down vote up
/**
 * Push the metric to the mr.
 * The metric is pushed only if it was updated since last push
 * 
 * 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) 
    mr.setMetric(getName(), value);
  changed = false;
}