Package com.dianping.cat.consumer.metric.model.entity

Examples of com.dianping.cat.consumer.metric.model.entity.MetricReport


    int index = 0;
    String type = pars.get("type");
    MetricReportMerger merger = new MetricReportMerger(all);

    for (; start < end; start += TimeHelper.ONE_HOUR) {
      MetricReport report = m_metricReportService.queryUserMonitorReport(url, pars, new Date(start));
     
      if (Monitor.TYPE_INFO.equals(type)) {
        Map<String, double[]> currentValues = fetchMetricInfoData(report);

        mergeMap(sourceValue, currentValues, totalSize, index);
        report.accept(merger);
      } else {
        Map<String, double[]> currentValues = fetchMetricCodeInfo(report);

        mergeMap(sourceValue, currentValues, totalSize, index);
      }
View Full Code Here


  }

  @Override
  public Pair<Map<String, LineChart>, List<PieChart>> queryBaseInfo(Date startDate, Date endDate, String url,
        Map<String, String> pars) {
    MetricReport report = new MetricReport(url);
    Map<String, double[]> oldCurrentValues = prepareAllData(report, url, pars, startDate, endDate);
    Map<String, double[]> allCurrentValues = m_dataExtractor.extract(oldCurrentValues);
    Map<String, double[]> dataWithOutFutures = removeFutureData(endDate, allCurrentValues);

    Map<String, LineChart> lineCharts = buildInfoChartData(oldCurrentValues, startDate, endDate, dataWithOutFutures);
View Full Code Here

    return new Pair<Map<String, LineChart>, List<PieChart>>(lineCharts, pieCharts);
  }

  @Override
  public Pair<LineChart, PieChart> queryErrorInfo(Date startDate, Date endDate, String url, Map<String, String> pars) {
    MetricReport report = new MetricReport(url);
    Map<String, double[]> oldCurrentValues = prepareAllData(report, url, pars, startDate, endDate);
    Map<String, double[]> allCurrentValues = m_dataExtractor.extract(oldCurrentValues);
    Map<String, double[]> dataWithOutFutures = removeFutureData(endDate, allCurrentValues);

    return buildErrorChartData(oldCurrentValues, startDate, endDate, dataWithOutFutures);
View Full Code Here

    }
  }

  @Override
  public void visitMetricReport(MetricReport metricReport) {
    m_report = new MetricReport(metricReport.getProduct());
    super.visitMetricReport(metricReport);
  }
View Full Code Here

    Map<String, double[]> sourceValue = new LinkedHashMap<String, double[]>();
    int index = 0;

    for (; start < end; start += TimeHelper.ONE_HOUR) {
      MetricReport report = m_metricReportService.queryCdnReport(CDN, properties, new Date(start));
      Map<String, double[]> currentValues;
      currentValues = fetchData(report);

      mergeMap(sourceValue, currentValues, totalSize, index);
      index++;
View Full Code Here

        if (Constants.METRIC_USER_MONITOR.equals(metricType)) {
          String city = payload.getCity();
          String channel = payload.getChannel();
          WebReportConvertor convert = new WebReportConvertor(type, city, channel);
          MetricReport metricReport = (MetricReport) response.getModel();

          convert.visitMetricReport(metricReport);
          ((ModelResponse<MetricReport>) response).setModel(convert.getReport());
        } else if (Constants.METRIC_SYSTEM_MONITOR.equals(metricType)) {
          String ipAddrsStr = payload.getIpAddress();
          Set<String> ipAddrs = null;

          if (!Constants.ALL.equalsIgnoreCase(ipAddrsStr)) {
            String[] ipAddrsArray = ipAddrsStr.split("_");
            ipAddrs = new HashSet<String>(Arrays.asList(ipAddrsArray));
          }

          SystemReportConvertor convert = new SystemReportConvertor(type, ipAddrs);
          MetricReport metricReport = (MetricReport) response.getModel();

          convert.visitMetricReport(metricReport);
          ((ModelResponse<MetricReport>) response).setModel(convert.getReport());
        } else if (Constants.METRIC_CDN.equals(metricType)) {
          String cdn = payload.getCdn();
          String province = payload.getProvince();
          String city = payload.getCity();
          MetricReport metricReport = (MetricReport) response.getModel();
          CdnReportConvertor cdnReportConvertor = new CdnReportConvertor(m_ipService);

          cdnReportConvertor.setProvince(province).setCity(city).setCdn(cdn);
          cdnReportConvertor.visitMetricReport(metricReport);
          ((ModelResponse<MetricReport>) response).setModel(cdnReportConvertor.getReport());
View Full Code Here

    }
  }

  @Override
  public void visitMetricReport(MetricReport metricReport) {
    m_report = new MetricReport(metricReport.getProduct());
    super.visitMetricReport(metricReport);
  }
View Full Code Here

    }
    return title;
  }

  protected MetricReport fetchMetricReport(String idPrefix, ModelPeriod period) {
    MetricReport report = null;

    if (period == ModelPeriod.CURRENT) {
      report = m_currentReports.get(idPrefix);
    } else if (period == ModelPeriod.LAST) {
      report = m_lastReports.get(idPrefix);
View Full Code Here

    Pair<Integer, List<Condition>> resultPair = queryCheckMinuteAndConditions(configs);
    int maxMinute = resultPair.getKey();
    List<Condition> conditions = resultPair.getValue();

    if (minute >= maxMinute - 1) {
      MetricReport report = fetchMetricReport(idPrefix, ModelPeriod.CURRENT);

      if (report != null) {
        int start = minute + 1 - maxMinute;
        int end = minute;
        Map<String, double[]> datas = fetchMetricInfoData(start, end, report);

        for (Condition condition : conditions) {
          results.addAll(computeAlertForCondition(datas, condition, type));
        }
      }
    } else if (minute < 0) {
      MetricReport report = fetchMetricReport(idPrefix, ModelPeriod.LAST);

      if (report != null) {
        int start = 60 + minute + 1 - (maxMinute);
        int end = 60 + minute;
        Map<String, double[]> datas = fetchMetricInfoData(start, end, report);

        for (Condition condition : conditions) {
          results.addAll(computeAlertForCondition(datas, condition, type));
        }
      }
    } else {
      MetricReport currentReport = fetchMetricReport(idPrefix, ModelPeriod.CURRENT);
      MetricReport lastReport = fetchMetricReport(idPrefix, ModelPeriod.LAST);

      if (currentReport != null && lastReport != null) {
        int currentStart = 0, currentEnd = minute;
        Map<String, double[]> currentValue = fetchMetricInfoData(currentStart, currentEnd, currentReport);
View Full Code Here

    }
    return oldCurrentValues;
  }

  private Map<String, double[]> queryMetricValueByDate(String productLine, long start) {
    MetricReport metricReport = m_metricReportService.queryMetricReport(productLine, new Date(start));
    Map<String, double[]> currentValues = m_pruductDataFetcher.buildGraphData(metricReport);
    double sum = 0;

    for (Entry<String, double[]> entry : currentValues.entrySet()) {
      double[] value = entry.getValue();
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.metric.model.entity.MetricReport

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.