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

Examples of com.dianping.cat.consumer.top.model.entity.TopReport


public class TopReportService extends AbstractReportService<TopReport> {

  @Override
  public TopReport makeReport(String domain, Date start, Date end) {
    TopReport report = new TopReport(domain);

    report.setStartTime(start);
    report.setEndTime(end);
    return report;
  }
View Full Code Here


    HourlyReportContent content = m_hourlyReportContentDao.findByPK(id, HourlyReportContentEntity.READSET_FULL);

    if (content != null) {
      return DefaultNativeParser.parse(content.getContent());
    } else {
      return new TopReport(domain);
    }
  }
View Full Code Here

    }
  }

  @Override
  public TopReport queryHourlyReport(String domain, Date start, Date end) {
    TopReportMerger merger = new TopReportMerger(new TopReport(domain));
    long startTime = start.getTime();
    long endTime = end.getTime();
    String name = TopAnalyzer.ID;

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_HOUR) {
      List<HourlyReport> reports = null;
      try {
        reports = m_hourlyReportDao.findAllByDomainNamePeriod(new Date(startTime), domain, name,
              HourlyReportEntity.READSET_FULL);
      } catch (DalException e) {
        Cat.logError(e);
      }
      if (reports != null) {
        for (HourlyReport report : reports) {
          String xml = report.getContent();

          try {
            if (xml != null && xml.length() > 0) {
              TopReport reportModel = com.dianping.cat.consumer.top.model.transform.DefaultSaxParser.parse(xml);
              reportModel.accept(merger);
            } else {
              TopReport reportModel = queryFromHourlyBinary(report.getId(), domain);
              reportModel.accept(merger);
            }
          } catch (DalNotFoundException e) {
            //ignore
          } catch (Exception e) {
            Cat.logError(e);
          }
        }
      }
    }
    TopReport topReport = merger.getTopReport();

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

    return report.getDomain();
  }

  @Override
  public TopReport makeReport(String domain, long startTime, long duration) {
    TopReport report = new TopReport(domain);

    report.setStartTime(new Date(startTime));
    report.setEndTime(new Date(startTime + duration - 1));

    return report;
  }
View Full Code Here

    return DefaultNativeParser.parse(bytes);
  }

  @Override
  public TopReport parseXml(String xml) throws Exception {
    TopReport report = DefaultSaxParser.parse(xml);

    return report;
  }
View Full Code Here

  }

  @Override
  public TopReport getReport(String domain) {
    Set<String> domains = m_transactionAnalyzer.getDomains();
    TopReport topReport = new TopReport(Constants.CAT);

    topReport.setStartTime(new Date(m_startTime));
    topReport.setEndTime(new Date(m_startTime + 60 * MINUTE - 1));

    TransactionReportVisitor transactionReportVisitor = new TransactionReportVisitor(topReport);

    for (String name : domains) {
      try {
View Full Code Here

  }

  public void buildTopErrorInfo(Payload payload, Model model) {
    int minuteCount = payload.getMinuteCounts();
    int minute = model.getMinute();
    TopReport report = queryTopReport(payload);
    List<String> excludeDomains = Arrays.asList(Constants.FRONT_END);
    TopMetric topMetric = new TopMetric(minuteCount, payload.getTopCounts(), m_configManager, excludeDomains);
    Date end = new Date(payload.getDate() + TimeHelper.ONE_MINUTE * minute);
    Date start = new Date(end.getTime() - TimeHelper.ONE_MINUTE * minuteCount);

 
View Full Code Here

    ModelRequest request = new ModelRequest(domain, payload.getDate()) //
          .setProperty("date", date);

    if (m_topService.isEligable(request)) {
      ModelResponse<TopReport> response = m_topService.invoke(request);
      TopReport report = response.getModel();
      if (report == null || report.getDomains().size() == 0) {
        report = m_reportService.queryTopReport(domain, new Date(payload.getDate()), new Date(payload.getDate()
              + TimeHelper.ONE_HOUR));
      }
      return report;
    } else {
View Full Code Here

  @Override
  protected TopReport merge(ModelRequest request, List<ModelResponse<TopReport>> responses) {
    if (responses.size() == 0) {
      return null;
    }
    TopReportMerger merger = new TopReportMerger(new TopReport(request.getDomain()));
    for (ModelResponse<TopReport> response : responses) {
      TopReport model = response.getModel();

      if (model != null) {
        model.accept(merger);
      }
    }

    return merger.getTopReport();
  }
View Full Code Here

  @Override
  protected TopReport buildModel(ModelRequest request) throws Exception {
    String domain = request.getDomain();
    long date = request.getStartTime();
    TopReport report;

    if (isLocalMode()) {
      report = getReportFromLocalDisk(date, domain);
    } else {
      report = getReportFromDatabase(date, domain);
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.top.model.entity.TopReport

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.