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

Examples of com.dianping.cat.consumer.problem.model.entity.ProblemReport


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

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


    MonthlyReportContent content = m_monthlyReportContentDao.findByPK(id, MonthlyReportContentEntity.READSET_FULL);

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

    WeeklyReportContent content = m_weeklyReportContentDao.findByPK(id, WeeklyReportContentEntity.READSET_FULL);

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

    }
  }

  @Override
  public ProblemReport queryHourlyReport(String domain, Date start, Date end) {
    ProblemReportMerger merger = new ProblemReportMerger(new ProblemReport(domain));
    long startTime = start.getTime();
    long endTime = end.getTime();
    String name = ProblemAnalyzer.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) {// for old xml storage
              ProblemReport reportModel = com.dianping.cat.consumer.problem.model.transform.DefaultSaxParser
                    .parse(xml);
              reportModel.accept(merger);
            } else {// for new binary storage, binary is same to report id
              ProblemReport reportModel = queryFromHourlyBinary(report.getId(), domain);

              reportModel.accept(merger);
            }
          } catch (DalNotFoundException e) {
            //ignore
          } catch (Exception e) {
            Cat.logError(e);
          }
        }
      }
    }
    ProblemReport problemReport = merger.getProblemReport();

    problemReport.setStartTime(start);
    problemReport.setEndTime(new Date(end.getTime() - 1));

    Set<String> domains = queryAllDomainNames(start, end, ProblemAnalyzer.ID);
    problemReport.getDomainNames().addAll(domains);
    return problemReport;
  }
View Full Code Here

    if (!StringUtils.isEmpty(payload.getStatus())) {
      request.setProperty("name", payload.getStatus());
    }
    if (m_service.isEligable(request)) {
      ModelResponse<ProblemReport> response = m_service.invoke(request);
      ProblemReport report = response.getModel();
      if (payload.getPeriod().isLast()) {
        Set<String> domains = m_reportService.queryAllDomainNames(new Date(payload.getDate()),
              new Date(payload.getDate() + TimeHelper.ONE_HOUR), ProblemAnalyzer.ID);
        Set<String> domainNames = report.getDomainNames();

        domainNames.addAll(domains);
      }

      return report;
View Full Code Here

  public void handleOutbound(Context ctx) throws ServletException, IOException {
    Model model = new Model(ctx);
    Payload payload = ctx.getPayload();
    normalize(model, payload);

    ProblemReport report = null;
    ProblemStatistics problemStatistics = new ProblemStatistics();
    String ip = model.getIpAddress();
    LongConfig longConfig = new LongConfig();
    Action action = payload.getAction();
    String domain = payload.getDomain();
    String group = payload.getGroup();

    longConfig.setSqlThreshold(payload.getSqlThreshold()).setUrlThreshold(payload.getUrlThreshold())
          .setServiceThreshold(payload.getServiceThreshold());
    longConfig.setCacheThreshold(payload.getCacheThreshold()).setCallThreshold(payload.getCallThreshold());
    problemStatistics.setLongConfig(longConfig);

    if (StringUtils.isEmpty(group)) {
      group = m_configManager.queryDefaultGroup(domain);
      payload.setGroup(group);
    }
    model.setGroupIps(m_configManager.queryIpByDomainAndGroup(domain, group));
    model.setGroups(m_configManager.queryDomainGroup(payload.getDomain()));
    switch (action) {
    case HOULY_REPORT:
      report = getHourlyReport(payload, VIEW);
      model.setReport(report);
      if (ip.equals(Constants.ALL)) {
        problemStatistics.setAllIp(true);
      } else {
        problemStatistics.setIp(ip);
      }
      problemStatistics.visitProblemReport(report);
      model.setAllStatistics(problemStatistics);
      break;
    case HISTORY_REPORT:
      report = showSummarizeReport(model, payload);
      if (ip.equals(Constants.ALL)) {
        problemStatistics.setAllIp(true);
        problemStatistics.visitProblemReport(report);
      } else {
        problemStatistics.setIp(ip);
        problemStatistics.visitProblemReport(report);
      }
      model.setReport(report);
      model.setAllStatistics(problemStatistics);
      break;
    case HISTORY_GRAPH:
      m_historyGraphs.buildTrendGraph(model, payload);

      report = showSummarizeReport(model, payload);
      buildDistributionChart(model, payload, report);
      break;
    case GROUP:
      report = showHourlyReport(model, payload);
      if (report != null) {
        model.setGroupLevelInfo(new GroupLevelInfo(model).display(report));
      }
      break;
    case HOUR_GRAPH:
      report = getHourlyReport(payload, DETAIL);
      String type = payload.getType();
      String state = payload.getStatus();
      Date start = report.getStartTime();
      HourlyLineChartVisitor vistor = new HourlyLineChartVisitor(ip, type, state, start);

      vistor.visitProblemReport(report);
      model.setErrorsTrend(m_jsonBuilder.toJson(vistor.getGraphItem()));
      buildDistributionChart(model, payload, report);
      break;
    case HOURLY_GROUP_REPORT:
      report = getHourlyReport(payload, VIEW);
      report = filterReportByGroup(report, domain, group);
      model.setReport(report);
      if (ip.equals(Constants.ALL)) {
        problemStatistics.setAllIp(true);
      } else {
        problemStatistics.setIp(ip);
      }
      problemStatistics.visitProblemReport(report);
      model.setAllStatistics(problemStatistics);
      break;
    case GROUP_GRAPHS:
      report = getHourlyReport(payload, DETAIL);
      report = filterReportByGroup(report, domain, group);
      type = payload.getType();
      state = payload.getStatus();
      start = report.getStartTime();
      vistor = new HourlyLineChartVisitor("", type, state, start);
      vistor.visitProblemReport(report);
      model.setErrorsTrend(m_jsonBuilder.toJson(vistor.getGraphItem()));
      buildDistributionChart(model, payload, report);
      break;
View Full Code Here

    } catch (DalNotFoundException e) {
      //ignore
    } catch (Exception e) {
      Cat.logError(e);
    }
    return new ProblemReport(domain);
  }
View Full Code Here

    } catch (DalNotFoundException e) {
      //ignore
    } catch (Exception e) {
      Cat.logError(e);
    }
    return new ProblemReport(domain);
  }
View Full Code Here

    model.setIpAddress(ipAddress);
    model.setGroupName(payload.getGroupName());
    model.setCurrentMinute(payload.getMinute());
    model.setThreadId(payload.getThreadId());

    ProblemReport report = getHourlyReport(payload, DETAIL);

    if (report == null) {
      return;
    }
    model.setReport(report);
View Full Code Here

      model.setLastMinute(minute);
    } else {
      model.setLastMinute(59);
    }
    model.setHour(getHour(model.getLongDate()));
    ProblemReport report = getHourlyReport(payload, DETAIL);
    if (report != null) {
      String ip = getIpAddress(report, payload);

      model.setIpAddress(ip);
      model.setReport(report);
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.problem.model.entity.ProblemReport

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.