MetricsRecordDelegator(String recordName, ArrayList<MetricsContext> ctxts) { this.recordName = recordName; this.subrecs = new ArrayList<MetricsRecord>(ctxts.size()); for (MetricsContext ctxt : ctxts) { subrecs.add(ctxt.createRecord(recordName)); } }
@InterfaceAudience.Private @Override public void close() { for (MetricsContext ctxt : subctxt) { ctxt.close(); } }
@InterfaceAudience.Private @Override public void unregisterUpdater(Updater updater) { for (MetricsContext ctxt : subctxt) { ctxt.unregisterUpdater(updater); } }
@InterfaceAudience.Private @Override public void stopMonitoring() { for (MetricsContext ctxt : subctxt) { ctxt.stopMonitoring(); } }
/** Return true if all subcontexts are monitoring. */ @InterfaceAudience.Private @Override public boolean isMonitoring() { boolean ret = true; for (MetricsContext ctxt : subctxt) { ret &= ctxt.isMonitoring(); } return ret; }
@InterfaceAudience.Private @Override protected void flush() throws IOException { for (MetricsContext ctxt : subctxt) { try { ((AbstractMetricsContext) ctxt).flush(); } catch (IOException e) { LOG.warn("flush failed: " + ctxt.getContextName(), e); } } }
@InterfaceAudience.Private @Override public void startMonitoring() throws IOException { for (MetricsContext ctxt : subctxt) { try { ctxt.startMonitoring(); } catch (IOException e) { LOG.warn("startMonitoring failed: " + ctxt.getContextName(), e); } } }
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); }
@InterfaceAudience.Private @Override protected void emitRecord(String contextName, String recordName, OutputRecord outRec) throws IOException { for (MetricsContext ctxt : subctxt) { try { ((AbstractMetricsContext) ctxt).emitRecord(contextName, recordName, outRec); if (contextName == null || recordName == null || outRec == null) { throw new IOException(contextName + ":" + recordName + ":" + outRec); } } catch (IOException e) { LOG.warn("emitRecord failed: " + ctxt.getContextName(), e); } } }
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); }
public SubscriptionHandlerMetrics(String subscriptionId) { this.subscriptionId = subscriptionId; context = MetricsUtil.getContext("subscriptionHandler"); metricsRecord = MetricsUtil.createRecord(context, subscriptionId); context.registerUpdater(this); mbean = new ProcessorMetricsMXBean(this.registry); }
UgiMetrics() { registry = new MetricsRegistry(); loginSuccess = new MetricsTimeVaryingRate( "loginSuccess", registry, "Rate of successful kerberos logins and time taken in milliseconds"); loginFailure = new MetricsTimeVaryingRate( "loginFailure", registry, "Rate of failed kerberos logins and time taken in milliseconds"); final MetricsContext metricsContext = MetricsUtil.getContext("ugi"); metricsRecord = MetricsUtil.createRecord(metricsContext, "ugi"); metricsContext.registerUpdater(this); }
public void shutdown() { context.unregisterUpdater(this); mbean.shutdown(); }
public MboxMetrics(String recordName) { context = MetricsUtil.getContext("mbox"); metricsRecord = MetricsUtil.createRecord(context, recordName); context.registerUpdater(this); mbean = new MboxMetricsMBean(this.registry); }