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

Examples of com.dianping.cat.consumer.cross.model.entity.CrossReport


    ServiceReport serviceReport = new ServiceReport(Constants.CAT);
    Date end = new Date(start.getTime() + TimeHelper.ONE_HOUR);
    Set<String> domains = m_reportService.queryAllDomainNames(start, end, CrossAnalyzer.ID);

    for (String domainName : domains) {
      CrossReport crossReport = m_reportService.queryCrossReport(domainName, start, end);
      ProjectInfo projectInfo = new ProjectInfo(TimeHelper.ONE_HOUR);

      projectInfo.setHostinfoService(m_hostinfoService);
      projectInfo.setClientIp(Constants.ALL);
      projectInfo.visitCrossReport(crossReport);
View Full Code Here


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

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

    super(CrossAnalyzer.ID);
  }

  @Override
  protected CrossReport getReport(ModelRequest request, ModelPeriod period, String domain) throws Exception {
    CrossReport report = super.getReport(request, period, domain);

    if (report == null && period.isLast()) {
      long startTime = request.getStartTime();
      report = getReportFromLocalDisk(startTime, domain);
     
      if (report == null) {
        report = new CrossReport(domain);
        report.setStartTime(new Date(startTime));
        report.setEndTime(new Date(startTime + TimeHelper.ONE_HOUR - 1));
      }
    }
    return report;
  }
View Full Code Here

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

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

public class CrossReportService extends AbstractReportService<CrossReport> {

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

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

    return report;
  }

  @Override
  public CrossReport queryDailyReport(String domain, Date start, Date end) {
    CrossReportMerger merger = new CrossReportMerger(new CrossReport(domain));
    long startTime = start.getTime();
    long endTime = end.getTime();
    String name = CrossAnalyzer.ID;

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_DAY) {
      try {
        DailyReport report = m_dailyReportDao.findByDomainNamePeriod(domain, name, new Date(startTime),
              DailyReportEntity.READSET_FULL);
        String xml = report.getContent();

        if (xml != null && xml.length() > 0) {
          CrossReport reportModel = com.dianping.cat.consumer.cross.model.transform.DefaultSaxParser.parse(xml);
          reportModel.accept(merger);
        } else {
          CrossReport reportModel = queryFromDailyBinary(report.getId(), domain);

          reportModel.accept(merger);
        }
      } catch (DalNotFoundException e) {
        //ignore
      } catch (Exception e) {
        Cat.logError(e);
      }
    }
    CrossReport crossReport = merger.getCrossReport();

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

TOP

Related Classes of com.dianping.cat.consumer.cross.model.entity.CrossReport

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.