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

Examples of com.dianping.cat.consumer.event.model.entity.EventReport


  public void handleOutbound(Context ctx) throws ServletException, IOException {
    Model model = new Model(ctx);
    Payload payload = ctx.getPayload();
    String type = payload.getType();
    TransactionReport transactionReport = null;
    EventReport eventReport = null;

    normalize(model, payload);
    switch (payload.getAction()) {
    case HOURLY_REPORT:
      transactionReport = getHourlyTransactionReport(payload);
View Full Code Here


public class EventReportService extends AbstractReportService<EventReport> {

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

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

    return report;
  }

  @Override
  public EventReport queryDailyReport(String domain, Date start, Date end) {
    EventReportMerger merger = new EventReportMerger(new EventReport(domain));
    long startTime = start.getTime();
    long endTime = end.getTime();
    String name = EventAnalyzer.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) {
          EventReport reportModel = com.dianping.cat.consumer.event.model.transform.DefaultSaxParser.parse(xml);
          reportModel.accept(merger);
        } else {
          EventReport reportModel = queryFromDailyBinary(report.getId(), domain);

          reportModel.accept(merger);
        }
      } catch (DalNotFoundException e) {
        //ignore
      } catch (Exception e) {
        Cat.logError(e);
      }
    }
    EventReport eventReport = merger.getEventReport();

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

    DailyReportContent content = m_dailyReportContentDao.findByPK(id, DailyReportContentEntity.READSET_FULL);

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

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

    if (content != null) {
      return DefaultNativeParser.parse(content.getContent());
    } else {
      return new EventReport(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 EventReport(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 EventReport(domain);
    }
  }
View Full Code Here

    }
  }

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

              reportModel.accept(merger);
            }
          } catch (DalNotFoundException e) {
            //ignore
          } catch (Exception e) {
            Cat.logError(e);
          }
        }
      }
    }
    EventReport eventReport = merger.getEventReport();

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

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

        String name = type.getId();
        data.put(name + TIME, m_format.format(type.getAvg()));
        data.put(name + COUNT, m_format.format(type.getTotalCount()));
      }
    }
    EventReport eventReport = getEventHourlyReport(domain, ip, null);
    if (eventReport == null) {
      return data;
    }
    com.dianping.cat.consumer.event.model.entity.Machine eventMachine = eventReport.getMachines().get(ip);
    if (eventMachine != null) {
      long exceptionCount = 0;
      EventType exception = eventMachine.findType("Exception");
      EventType runtimeException = eventMachine.findType("RuntimeException");
View Full Code Here

      request.setProperty("type", type);
    }

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

      report = m_eventMergerMergeManager.mergerAllIp(report, ip);
      return report;
    } else {
      throw new RuntimeException("Internal error: no eligable transaction service registered for " + request + "!");
View Full Code Here

TOP

Related Classes of com.dianping.cat.consumer.event.model.entity.EventReport

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.