Пример #1
0
 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));
   }
 }
Пример #2
0
 @InterfaceAudience.Private
 @Override
 public void close() {
   for (MetricsContext ctxt : subctxt) {
     ctxt.close();
   }
 }
Пример #3
0
 @InterfaceAudience.Private
 @Override
 public void unregisterUpdater(Updater updater) {
   for (MetricsContext ctxt : subctxt) {
     ctxt.unregisterUpdater(updater);
   }
 }
Пример #4
0
 @InterfaceAudience.Private
 @Override
 public void stopMonitoring() {
   for (MetricsContext ctxt : subctxt) {
     ctxt.stopMonitoring();
   }
 }
Пример #5
0
 /** 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;
 }
Пример #6
0
 @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);
     }
   }
 }
Пример #7
0
 @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);
     }
   }
 }
Пример #8
0
 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);
 }
Пример #9
0
 @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);
     }
   }
 }
Пример #10
0
  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);
  }
Пример #11
0
 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);
 }
Пример #13
0
 public void shutdown() {
   context.unregisterUpdater(this);
   mbean.shutdown();
 }
Пример #14
0
 public MboxMetrics(String recordName) {
   context = MetricsUtil.getContext("mbox");
   metricsRecord = MetricsUtil.createRecord(context, recordName);
   context.registerUpdater(this);
   mbean = new MboxMetricsMBean(this.registry);
 }