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

Examples of com.dianping.cat.consumer.transaction.model.entity.TransactionReport


public class TransactionMerger {

  private TransactionReport merge(String reportDomain, List<TransactionReport> reports, boolean isDaily) {
    TransactionReportMerger merger = null;
    if (isDaily) {
      merger = new HistoryTransactionReportMerger(new TransactionReport(reportDomain));
    } else {
      merger = new TransactionReportMerger(new TransactionReport(reportDomain));
    }
    for (TransactionReport report : reports) {
      report.accept(merger);
    }
View Full Code Here


    return merger.getTransactionReport();
  }

  public TransactionReport mergeForDaily(String reportDomain, List<TransactionReport> reports, Set<String> domainSet) {
    TransactionReport transactionReport = merge(reportDomain, reports, true);
    HistoryTransactionReportMerger merger = new HistoryTransactionReportMerger(new TransactionReport(reportDomain));
    TransactionReport transactionReport2 = merge(reportDomain, reports, true);
    com.dianping.cat.consumer.transaction.model.entity.Machine allMachines = merger
          .mergesForAllMachine(transactionReport2);
    transactionReport.addMachine(allMachines);
    transactionReport.getIps().add("All");
    transactionReport.getDomainNames().addAll(domainSet);
View Full Code Here

  }

  private List<String> queryIpsFromReport(String domain) {
    Date startDate = TimeHelper.getCurrentDay(-2);
    Date endDate = TimeHelper.getCurrentDay();
    TransactionReport report = m_reportService.queryDailyReport(domain, startDate, endDate);
    Set<String> ipSet = report.getMachines().keySet();
    List<String> ipList = new ArrayList<String>();
    ipList.addAll(ipSet);

    return ipList;
  }
View Full Code Here

  @Override
  public boolean buildDailyTask(String name, String domain, Date period) {
    try {
      Date end = TaskHelper.tomorrowZero(period);
      TransactionReport transactionReport = queryHourlyReportsByDuration(name, domain, period, end);

      buildDailyTransactionGraph(transactionReport);

      DailyReport report = new DailyReport();
View Full Code Here

    }
  }

  private List<Graph> buildHourlyGraphs(String name, String domain, Date period) throws DalException {
    long startTime = period.getTime();
    TransactionReport report = m_reportService.queryTransactionReport(domain, new Date(startTime), new Date(startTime
          + TimeHelper.ONE_HOUR));
   
    return m_transactionGraphCreator.splitReportToGraphs(period, domain, TransactionAnalyzer.ID, report);
  }
View Full Code Here

    return true;
  }

  @Override
  public boolean buildMonthlyTask(String name, String domain, Date period) {
    TransactionReport transactionReport = 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) {
    TransactionReport transactionReport = 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 TransactionReport queryDailyReportsByDuration(String domain, Date start, Date end) {
    long startTime = start.getTime();
    long endTime = end.getTime();
    TransactionReportMerger merger = new TransactionReportMerger(new TransactionReport(domain));

    for (; startTime < endTime; startTime += TimeHelper.ONE_DAY) {
      try {
        TransactionReport reportModel = m_reportService.queryTransactionReport(domain, new Date(startTime),
              new Date(startTime + TimeHelper.ONE_DAY));

        reportModel.accept(merger);
      } catch (Exception e) {
        Cat.logError(e);
      }
    }
    TransactionReport transactionReport = merger.getTransactionReport();

    transactionReport.setStartTime(start);
    transactionReport.setEndTime(end);
    new TransactionReportCountFilter().visitTransactionReport(transactionReport);
    return transactionReport;
  }
View Full Code Here

    List<TransactionReport> reports = new ArrayList<TransactionReport>();
    long startTime = start.getTime();
    long endTime = endDate.getTime();

    for (; startTime < endTime; startTime = startTime + TimeHelper.ONE_HOUR) {
      TransactionReport report = m_reportService.queryTransactionReport(domain, new Date(startTime), new Date(
            startTime + TimeHelper.ONE_HOUR));

      reports.add(report);
    }
    return m_transactionMerger.mergeForDaily(domain, reports, domainSet);
View Full Code Here

    for (String domain : domains) {
      if (m_configManger.validateDomain(domain)) {
        Transaction t = Cat.newTransaction("ReloadTask", "Reload-Month-" + domain);

        TransactionReport transactionReport = m_reportService.queryTransactionReport(domain, start, end);
        new TransactionReportCountFilter().visitTransactionReport(transactionReport);

        m_reportService.insertMonthlyReport(buildMonthlyReport(domain, start, TransactionAnalyzer.ID),
              com.dianping.cat.consumer.transaction.model.transform.DefaultNativeBuilder.build(transactionReport));
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.transaction.model.entity.TransactionReport

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.