Ejemplo n.º 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));
   }
 }
Ejemplo n.º 2
0
 @InterfaceAudience.Private
 @Override
 public void close() {
   for (MetricsContext ctxt : subctxt) {
     ctxt.close();
   }
 }
Ejemplo n.º 3
0
 @InterfaceAudience.Private
 @Override
 public void unregisterUpdater(Updater updater) {
   for (MetricsContext ctxt : subctxt) {
     ctxt.unregisterUpdater(updater);
   }
 }
Ejemplo n.º 4
0
 @InterfaceAudience.Private
 @Override
 public void stopMonitoring() {
   for (MetricsContext ctxt : subctxt) {
     ctxt.stopMonitoring();
   }
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 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);
     }
   }
 }
Ejemplo n.º 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);
     }
   }
 }
Ejemplo n.º 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);
 }
Ejemplo n.º 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);
     }
   }
 }
Ejemplo n.º 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);
  }
Ejemplo n.º 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);
 }
Ejemplo n.º 13
0
 public void shutdown() {
   context.unregisterUpdater(this);
   mbean.shutdown();
 }
Ejemplo n.º 14
0
 public MboxMetrics(String recordName) {
   context = MetricsUtil.getContext("mbox");
   metricsRecord = MetricsUtil.createRecord(context, recordName);
   context.registerUpdater(this);
   mbean = new MboxMetricsMBean(this.registry);
 }