/** * 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); } }
public void doUpdates(MetricsContext metricsContext) { synchronized (this) { for (MetricsBase m : registry.getMetricsList()) { m.pushMetric(metricsRecord); } } metricsRecord.update(); }
/** * 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; }
public TaskTrackerMetricsInst(TaskTracker t) { super(t); JobConf conf = tt.getJobConf(); String sessionId = conf.getSessionId(); // Initiate Java VM Metrics JvmMetrics.init("TaskTracker", sessionId); // Create a record for Task Tracker metrics MetricsContext context = MetricsUtil.getContext("mapred"); metricsRecord = MetricsUtil.createRecord(context, "tasktracker"); // guaranteed never null metricsRecord.setTag("sessionId", sessionId); context.registerUpdater(this); }
/** Push the metrics to the monitoring subsystem on doUpdate() call. */ public void doUpdates(MetricsContext context) { synchronized (this) { // ToFix - fix server to use the following two metrics directly so // the metrics do not have be copied here. numOpenConnections.set(myServer.getNumOpenConnections()); callQueueLen.set(myServer.getCallQueueLen()); for (MetricsBase m : registry.getMetricsList()) { m.pushMetric(metricsRecord); } } metricsRecord.update(); }
/** * 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(); }
public RpcMetrics(String hostName, String port, Server server) { myServer = server; MetricsContext context = MetricsUtil.getContext("rpc"); metricsRecord = MetricsUtil.createRecord(context, "metrics"); metricsRecord.setTag("port", port); LOG.info("Initializing RPC Metrics with hostName=" + hostName + ", port=" + port); context.registerUpdater(this); // Need to clean up the interface to RpcMgt - don't need both metrics // and server params rpcMBean = new RpcActivityMBean(registry, hostName, port); }