Package com.dianping.cat.broker.api.page

Examples of com.dianping.cat.broker.api.page.MonitorEntity


  public void handleOutbound(Context ctx) throws ServletException, IOException {
    Payload payload = ctx.getPayload();
    HttpServletRequest request = ctx.getHttpServletRequest();
    HttpServletResponse response = ctx.getHttpServletResponse();

    MonitorEntity entity = new MonitorEntity();
    String userIp = m_util.getRemoteIp(request);

    if (userIp != null) {
      String errorCode = payload.getErrorCode();
      String httpStatus = payload.getHttpStatus();

      Cat.logEvent("ip", "hit", Event.SUCCESS, userIp);

      entity.setDuration(payload.getDuration());
      entity.setErrorCode(errorCode);
      entity.setHttpStatus(httpStatus);
      entity.setIp(userIp);
      entity.setTargetUrl(payload.getTargetUrl());
      entity.setTimestamp(System.currentTimeMillis());
      m_manager.offer(entity);
    } else {
      Cat.logEvent("unknownIp", "single", Event.SUCCESS, null);
      m_logger.info("unknown http request, x-forwarded-for:" + request.getHeader("x-forwarded-for"));
    }
View Full Code Here


  private RequestUtils m_util;

  private Logger m_logger;

  private MonitorEntity createEntity(String url, long timestamp, double duration, String userIp) {
    MonitorEntity entity = new MonitorEntity();

    entity.setTimestamp(timestamp);
    entity.setTargetUrl(url);
    entity.setDuration(duration);
    entity.setHttpStatus("200");
    entity.setErrorCode("200");
    entity.setIp(userIp);
    return entity;
  }
View Full Code Here

          String[] tabs = line.split("\t");
          // timstampTABtargetUrlTABdnslookupTABtcpconnectTABrequestTABresponseENTER
          if (tabs.length == 6) {
            // long timestamp = Long.parseLong(tabs[0]);
            long timestamp = System.currentTimeMillis();
            MonitorEntity entity = createEntity(tabs[1] + "/dnsLookup", timestamp, Double.parseDouble(tabs[2]),
                  userIp);

            m_manager.offer(entity);

            entity = createEntity(tabs[1] + "/tcpConnect", timestamp, Double.parseDouble(tabs[3]), userIp);
View Full Code Here

TOP

Related Classes of com.dianping.cat.broker.api.page.MonitorEntity

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.