public static void updateLatency(MetricsTimeVaryingRate metric, long beginTs, boolean logSlowOp, String message) { long consumeInUs = (System.nanoTime() - beginTs) / 1000; metric.inc(consumeInUs); if (logSlowOp) { logSlowOperationInternal(metric.getName(), consumeInUs, message); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
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(); LOG.info("pushMetric failed for " + getName() + "\n" + StringUtils.stringifyException(e));