Esempio n. 1
0
  private TransactionReport getHourlyReport(Payload payload) {
    String domain = payload.getDomain();
    String date = String.valueOf(payload.getDate());
    String ipAddress = payload.getIpAddress();
    ModelRequest request =
        new ModelRequest(domain, payload.getPeriod()) //
            .setProperty("date", date) //
            .setProperty("type", payload.getType()) //
            .setProperty("ip", ipAddress);

    if (m_service.isEligable(request)) {
      ModelResponse<TransactionReport> response = m_service.invoke(request);
      TransactionReport report = response.getModel();

      if (payload.getPeriod().isLast()) {
        Date start = new Date(payload.getDate());
        Date end = new Date(payload.getDate() + TimeUtil.ONE_HOUR);

        if (CatString.ALL.equals(domain)) {
          report = m_reportService.queryTransactionReport(domain, start, end);
        }
        Set<String> domains = m_reportService.queryAllDomainNames(start, end, "transaction");
        Set<String> domainNames = report.getDomainNames();

        domainNames.addAll(domains);
      }
      report = m_mergeManager.mergerAllIp(report, ipAddress);
      calculateTps(payload, report);
      return report;
    } else {
      throw new RuntimeException(
          "Internal error: no eligable transaction service registered for " + request + "!");
    }
  }
Esempio n. 2
0
  private TransactionReport getHourlyReport(Payload payload) {
    String domain = payload.getDomain();
    String ipAddress = payload.getIpAddress();
    ModelRequest request =
        new ModelRequest(domain, payload.getDate())
            .setProperty("type", payload.getType())
            .setProperty("ip", ipAddress);

    if (m_service.isEligable(request)) {
      ModelResponse<TransactionReport> response = m_service.invoke(request);
      TransactionReport report = response.getModel();

      if (payload.getPeriod().isLast()) {
        Date start = new Date(payload.getDate());
        Date end = new Date(payload.getDate() + TimeHelper.ONE_HOUR);

        if (Constants.ALL.equals(domain)) {
          report = m_reportService.queryTransactionReport(domain, start, end);
        }
        Set<String> domains =
            m_reportService.queryAllDomainNames(start, end, TransactionAnalyzer.ID);
        Set<String> domainNames = report.getDomainNames();

        domainNames.addAll(domains);
      }
      return report;
    } else {
      throw new RuntimeException(
          "Internal error: no eligable transaction service registered for " + request + "!");
    }
  }
Esempio n. 3
0
  private TransactionName getTransactionName(Payload payload) {
    String domain = payload.getDomain();
    String type = payload.getType();
    String name = payload.getName();
    String ip = payload.getIpAddress();
    String ipAddress = payload.getIpAddress();
    String date = String.valueOf(payload.getDate());
    ModelRequest request =
        new ModelRequest(domain, payload.getPeriod()) //
            .setProperty("date", date) //
            .setProperty("type", payload.getType()) //
            .setProperty("name", payload.getName()) //
            .setProperty("ip", ipAddress);
    if (name == null || name.length() == 0) {
      request.setProperty("name", "*");
      request.setProperty("all", "true");
      name = CatString.ALL;
    }
    ModelResponse<TransactionReport> response = m_service.invoke(request);
    TransactionReport report = response.getModel();

    report = m_mergeManager.mergerAll(report, ipAddress, name);
    TransactionType t = report.getMachines().get(ip).findType(type);
    if (t != null) {
      TransactionName n = t.findName(name);
      if (n != null) {
        n.accept(m_computer);
      }
      return n;
    } else {
      return null;
    }
  }
Esempio n. 4
0
  private TransactionReport getTransactionGraphReport(Model model, Payload payload) {
    String domain = payload.getDomain();
    String ipAddress = payload.getIpAddress();
    String name = payload.getName();
    ModelRequest request =
        new ModelRequest(domain, payload.getDate()) //
            .setProperty("type", payload.getType()) //
            .setProperty("name", payload.getName()) //
            .setProperty("ip", ipAddress);

    if (name == null || name.length() == 0) {
      request.setProperty("name", "*");
      request.setProperty("all", "true");
      name = Constants.ALL;
    }
    ModelResponse<TransactionReport> response = m_service.invoke(request);
    TransactionReport report = response.getModel();
    return report;
  }