Package com.dianping.cat.report.page.model.metric

Examples of com.dianping.cat.report.page.model.metric.MetricReportMerger


    throw new RuntimeException("Metric report don't support daily report");
  }

  @Override
  public MetricReport queryHourlyReport(String group, Date start, Date end) {
    MetricReportMerger merger = new MetricReportMerger(new MetricReport(group));

    try {
      List<BusinessReport> reports = m_businessReportDao.findAllByPeriodProductLineName(start, group,
            BusinessReportEntity.READSET_FULL);

      for (BusinessReport report : reports) {
        byte[] content = report.getContent();

        try {
          MetricReport reportModel = DefaultNativeParser.parse(content);

          reportModel.accept(merger);
        } catch (Exception e) {
          Cat.logError(e);
          Cat.getProducer().logEvent("ErrorXML", MetricAnalyzer.ID, Event.SUCCESS,
                report.getProductLine() + " " + report.getPeriod() + " " + report.getId());
        }
      }
    } catch (DalNotFoundException e) {
      m_logger.warn(this.getClass().getSimpleName() + " " + group + " " + start + " " + end);
    } catch (Exception e) {
      Cat.logError(e);
    }
    MetricReport metricReport = merger.getMetricReport();

    metricReport.setStartTime(start);
    metricReport.setEndTime(new Date(end.getTime() - 1));
    return transform(metricReport);
  }
View Full Code Here


    if (reports.size() != count && require != null) {
      Cat.logEvent("FetchMetricReportError", request.getDomain(), Event.SUCCESS, null);

      return null;
    } else {
      MetricReportMerger merger = new MetricReportMerger(new MetricReport(request.getDomain()));

      for (MetricReport report : reports) {
        report.accept(merger);
      }
      return merger.getMetricReport();
    }
  }
View Full Code Here

    String oldXml = Files.forIO().readFrom(getClass().getResourceAsStream("MetricReportOld.xml"), "utf-8");
    String newXml = Files.forIO().readFrom(getClass().getResourceAsStream("MetricReportNew.xml"), "utf-8");
    MetricReport reportOld = DefaultSaxParser.parse(oldXml);
    MetricReport reportNew = DefaultSaxParser.parse(newXml);
    String expected = Files.forIO().readFrom(getClass().getResourceAsStream("MetricReportMergeResult.xml"), "utf-8");
    MetricReportMerger merger = new MetricReportMerger(new MetricReport(reportOld.getProduct()));

    reportOld.accept(merger);
    reportNew.accept(merger);

    Assert.assertEquals("Check the merge result!", expected.replaceAll("\\r", ""), merger.getMetricReport().toString().replaceAll("\\r", ""));
    Assert.assertEquals("Source report is changed!", newXml.replaceAll("\\r", ""), reportNew.toString().replaceAll("\\r", ""));
  }
View Full Code Here

    long start = startDate.getTime(), end = endDate.getTime();
    int totalSize = (int) ((end - start) / TimeHelper.ONE_MINUTE);
    Map<String, double[]> sourceValue = new LinkedHashMap<String, double[]>();
    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)) {
View Full Code Here

TOP

Related Classes of com.dianping.cat.report.page.model.metric.MetricReportMerger

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.