Package com.alibaba.jstorm.metric

Examples of com.alibaba.jstorm.metric.UserDefMetric


                               SortedMap<String, Counter> counters,
                               SortedMap<String, Histogram> histograms,
                               SortedMap<String, Meter> meters,
                               SortedMap<String, Timer> timers,
                               boolean metricPerf) {   
      UserDefMetric userDefMetric = Metrics.getUserDefMetric();
     
        for (Entry<String, Gauge> entry : gauges.entrySet()) {
                logGauge(entry.getKey(), entry.getValue());
        }

        for (Entry<String, Counter> entry : counters.entrySet()) {
                logCounter(entry.getKey(), entry.getValue());
        }

        for (Entry<String, Meter> entry : meters.entrySet()) {
                logMeter(entry.getKey(), entry.getValue());
        }

        if (metricPerf == true) {
            for (Entry<String, Histogram> entry : histograms.entrySet()) {
                logHistogram(entry.getKey(), entry.getValue());
            }
       
            for (Entry<String, Timer> entry : timers.entrySet()) {
              Map<String, Timer> timerMap = userDefMetric.getTimer();
                logTimer(entry.getKey(), entry.getValue());
            }
        }
    }
View Full Code Here


      StormClusterState clusterState = workerData.getZkCluster();
      String topologyId = workerData.getTopologyId();
      String hostName =JStormServerUtils.getHostName(workerData.getConf());
      String workerId = hostName + ":" + workerData.getPort();
     
      UserDefMetric userDefMetric = Metrics.getUserDefMetric();
      UserDefMetricData userDefMetricData = new UserDefMetricData();
      userDefMetricData.updateFromGauge(userDefMetric.getGauge());
      userDefMetricData.updateFromCounter(userDefMetric.getCounter());
      userDefMetricData.updateFromMeterData(userDefMetric.getMeter());
      // If metrics performance is disable, Timer & Histogram metrics will not be monitored,
      // and the corresponding metrics data will not be sent to ZK either.
      if (metricPerf == false) {
         userDefMetricData.updateFromHistogramData(userDefMetric.getHistogram());
         userDefMetricData.updateFromTimerData(userDefMetric.getTimer());
      }

      try {
          clusterState.update_userDef_metric(topologyId, workerId, userDefMetricData);
      } catch(Exception e) {
        logger.error(marker, "Failed to update user define metrics data in ZK for topo-{} idStr-{}.",
                topologyId, workerId, e);
      }
     
      //Do callbacks defined by user
      doCallback(userDefMetric.getGauge());
      doCallback(userDefMetric.getCounter());
      doCallback(userDefMetric.getMeter());
      if (metricPerf == false) {
          doCallback(userDefMetric.getHistogram());
          doCallback(userDefMetric.getTimer());
      }
    }
View Full Code Here

TOP

Related Classes of com.alibaba.jstorm.metric.UserDefMetric

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.