Package com.dianping.cat.home.utilization.entity

Examples of com.dianping.cat.home.utilization.entity.UtilizationReport


  @Inject
  private HostinfoService m_hostinfoService;

  @Override
  public boolean buildDailyTask(String name, String domain, Date period) {
    UtilizationReport utilizationReport = queryHourlyReportsByDuration(name, domain, period,
          TaskHelper.tomorrowZero(period));
    DailyReport report = new DailyReport();

    report.setContent("");
    report.setCreationDate(new Date());
View Full Code Here


    return m_reportService.insertDailyReport(report, binaryContent);
  }

  @Override
  public boolean buildHourlyTask(String name, String domain, Date start) {
    UtilizationReport utilizationReport = new UtilizationReport(Constants.CAT);
    Date end = new Date(start.getTime() + TimeHelper.ONE_HOUR);
    Set<String> domains = m_reportService.queryAllDomainNames(start, end, TransactionAnalyzer.ID);
    TransactionReportVisitor transactionVisitor = new TransactionReportVisitor()
          .setUtilizationReport(utilizationReport);
    HeartbeatReportVisitor heartbeatVisitor = new HeartbeatReportVisitor().setUtilizationReport(utilizationReport);

    for (String domainName : domains) {
      if (m_configManger.validateDomain(domainName)) {
        TransactionReport transactionReport = m_reportService.queryTransactionReport(domainName, start, end);
        int size = transactionReport.getMachines().size();

        utilizationReport.findOrCreateDomain(domainName).setMachineNumber(size);
        transactionReport = m_mergeManager.mergerAllIp(transactionReport, Constants.ALL);
        transactionVisitor.visitTransactionReport(transactionReport);
      }
    }

    for (String domainName : domains) {
      if (m_configManger.validateDomain(domainName)) {
        HeartbeatReport heartbeatReport = m_reportService.queryHeartbeatReport(domainName, start, end);

        heartbeatVisitor.visitHeartbeatReport(heartbeatReport);
      }
    }

    for (String domainName : domains) {
      if (m_configManger.validateDomain(domainName)) {
        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);
        Collection<TypeDetailInfo> callInfos = projectInfo.getCallProjectsInfo();

        for (TypeDetailInfo typeInfo : callInfos) {
          String project = typeInfo.getProjectName();

          if (!validataService(project)) {
            long failure = typeInfo.getFailureCount();
            Domain d = utilizationReport.findOrCreateDomain(project);
            ApplicationState service = d.findApplicationState("PigeonService");

            if (service != null) {
              service.setFailureCount(service.getFailureCount() + failure);

              long count = service.getCount();
              if (count > 0) {
                service.setFailurePercent(service.getFailureCount() * 1.0 / count);
              }
            }
          }
        }
      }
    }

    utilizationReport.setStartTime(start);
    utilizationReport.setEndTime(end);

    HourlyReport report = new HourlyReport();

    report.setContent("");
    report.setCreationDate(new Date());
View Full Code Here

    return m_reportService.insertHourlyReport(report, binaryContent);
  }

  @Override
  public boolean buildMonthlyTask(String name, String domain, Date period) {
    UtilizationReport utilizationReport = queryDailyReportsByDuration(domain, period,
          TaskHelper.nextMonthStart(period));
    MonthlyReport report = new MonthlyReport();

    report.setContent("");
    report.setCreationDate(new Date());
View Full Code Here

    return m_reportService.insertMonthlyReport(report, binaryContent);
  }

  @Override
  public boolean buildWeeklyTask(String name, String domain, Date period) {
    UtilizationReport utilizationReport = queryDailyReportsByDuration(domain, period, new Date(period.getTime()
          + TimeHelper.ONE_WEEK));
    WeeklyReport report = new WeeklyReport();

    report.setContent("");
    report.setCreationDate(new Date());
View Full Code Here

  }

  private UtilizationReport queryDailyReportsByDuration(String domain, Date start, Date end) {
    long startTime = start.getTime();
    long endTime = end.getTime();
    UtilizationReportMerger merger = new UtilizationReportMerger(new UtilizationReport(domain));

    for (; startTime < endTime; startTime += TimeHelper.ONE_DAY) {
      try {
        UtilizationReport reportModel = m_reportService.queryUtilizationReport(domain, new Date(startTime),
              new Date(startTime + TimeHelper.ONE_DAY));
        reportModel.accept(merger);
      } catch (Exception e) {
        Cat.logError(e);
      }
    }
    UtilizationReport utilizationReport = merger.getUtilizationReport();

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

  }

  private UtilizationReport queryHourlyReportsByDuration(String name, String domain, Date start, Date end) {
    long startTime = start.getTime();
    long endTime = end.getTime();
    UtilizationReportMerger merger = new UtilizationReportMerger(new UtilizationReport(domain));

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_HOUR) {
      Date date = new Date(startTime);
      UtilizationReport reportModel = m_reportService.queryUtilizationReport(domain, date, new Date(date.getTime()
            + TimeHelper.ONE_HOUR));

      reportModel.accept(merger);
    }
    UtilizationReport utilizationReport = merger.getUtilizationReport();

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

    super.mergeUtilizationReport(old, bugReport);
  }

  @Override
  public void visitUtilizationReport(UtilizationReport utilizationReport) {
    UtilizationReport oldReport = getUtilizationReport();

    oldReport.setDomain(utilizationReport.getDomain());
    oldReport.setStartTime(utilizationReport.getStartTime());
    oldReport.setEndTime(utilizationReport.getEndTime());
    super.visitUtilizationReport(utilizationReport);
  }
View Full Code Here

      model.setCacheServices(cacheServices);
    }
  }

  private void buildUtilizationInfo(Model model, Payload payload) {
    UtilizationReport utilizationReport = queryUtilizationReport(payload);
    Collection<com.dianping.cat.home.utilization.entity.Domain> dUList = utilizationReport.getDomains().values();
    List<com.dianping.cat.home.utilization.entity.Domain> dUWebList = new LinkedList<com.dianping.cat.home.utilization.entity.Domain>();
    List<com.dianping.cat.home.utilization.entity.Domain> dUServiceList = new LinkedList<com.dianping.cat.home.utilization.entity.Domain>();

    for (com.dianping.cat.home.utilization.entity.Domain d : dUList) {
      if (d.findApplicationState("URL") != null) {
View Full Code Here

    return new Pair<Date, Date>(start, end);
  }

  private UtilizationReport queryUtilizationReport(Payload payload) {
    Pair<Date, Date> pair = queryStartEndTime(payload);
    UtilizationReport report = m_reportService.queryUtilizationReport(Constants.CAT, pair.getKey(), pair.getValue());
    Collection<com.dianping.cat.home.utilization.entity.Domain> domains = report.getDomains().values();

    for (com.dianping.cat.home.utilization.entity.Domain d : domains) {
      String domain = d.getId();
      Project project = m_projectService.findByDomain(domain);
View Full Code Here

public class UtilizationReportService extends AbstractReportService<UtilizationReport> {

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

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

TOP

Related Classes of com.dianping.cat.home.utilization.entity.UtilizationReport

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.