Package com.dianping.cat.home.dependency.exception.entity

Examples of com.dianping.cat.home.dependency.exception.entity.ExceptionLimit


    private Map<String, ExceptionExclude> exceptionExcludeMap = new HashMap<String, ExceptionExclude>();

    public ExceptionConfigMock() {
      // exception limit
      ExceptionLimit exceptionAA = new ExceptionLimit("exceptionA");
      exceptionAA.setDomain("domainA").setError(10).setWarning(5);
      exceptionLimitMap.put(exceptionAA.getDomain() + "_" + exceptionAA.getId(), exceptionAA);

      ExceptionLimit exceptionAT = new ExceptionLimit("Total");
      exceptionAT.setDomain("domainA").setError(20).setWarning(10);
      exceptionLimitMap.put(exceptionAT.getDomain(), exceptionAT);

      ExceptionLimit exceptionBA = new ExceptionLimit("exceptionA");
      exceptionBA.setDomain("domainB").setError(10).setWarning(5);
      exceptionLimitMap.put(exceptionBA.getDomain() + "_" + exceptionBA.getId(), exceptionBA);

      ExceptionLimit exceptionCA = new ExceptionLimit("exceptionA");
      exceptionCA.setDomain("domainC").setError(10).setWarning(5);
      exceptionLimitMap.put(exceptionCA.getDomain() + "_" + exceptionCA.getId(), exceptionCA);

      ExceptionLimit exceptionCB = new ExceptionLimit("exceptionB");
      exceptionCB.setDomain("domainC").setError(10).setWarning(5);
      exceptionLimitMap.put(exceptionCB.getDomain() + "_" + exceptionCB.getId(), exceptionCB);

      ExceptionLimit exceptionCC = new ExceptionLimit("exceptionC");
      exceptionCC.setDomain("domainC").setError(10).setWarning(5);
      exceptionLimitMap.put(exceptionCC.getDomain() + "_" + exceptionCC.getId(), exceptionCC);

      ExceptionLimit exceptionCD = new ExceptionLimit("exceptionD");
      exceptionCD.setDomain("domainC").setError(10).setWarning(5);
      exceptionLimitMap.put(exceptionCD.getDomain() + "_" + exceptionCD.getId(), exceptionCD);

      ExceptionLimit exceptionCT = new ExceptionLimit("Total");
      exceptionCT.setDomain("domainC").setError(20).setWarning(10);
      exceptionLimitMap.put(exceptionCT.getDomain(), exceptionCT);

      // exception exclude
      ExceptionExclude exceptionAll = new ExceptionExclude("All");
      exceptionAll.setDomain("domainA");
      exceptionExcludeMap.put(exceptionAll.getDomain() + "_" + exceptionAll.getId(), exceptionAll);
View Full Code Here


    return excluded;
  }

  private boolean needSendSms(String domain, String exception) {
    boolean send = false;
    ExceptionLimit limit = m_exceptionConfigManager.queryDomainExceptionLimit(domain, exception);

    if (limit != null) {
      send = limit.getSmsSending();
    }
    return send;
  }
View Full Code Here

    }
    return send;
  }

  private Pair<Double, Double> queryDomainExceptionLimit(String domain, String exceptionName) {
    ExceptionLimit exceptionLimit = m_exceptionConfigManager.queryDomainExceptionLimit(domain, exceptionName);
    Pair<Double, Double> limits = new Pair<Double, Double>();
    double warnLimit = -1;
    double errorLimit = -1;

    if (exceptionLimit != null) {
      warnLimit = exceptionLimit.getWarning();
      errorLimit = exceptionLimit.getError();
    }
    limits.setKey(warnLimit);
    limits.setValue(errorLimit);

    return limits;
View Full Code Here

    return limits;
  }

  private Pair<Double, Double> queryDomainTotalLimit(String domain) {
    ExceptionLimit totalExceptionLimit = m_exceptionConfigManager.queryDomainTotalLimit(domain);
    Pair<Double, Double> limits = new Pair<Double, Double>();
    double totalWarnLimit = -1;
    double totalErrorLimit = -1;

    if (totalExceptionLimit != null) {
      totalWarnLimit = totalExceptionLimit.getWarning();
      totalErrorLimit = totalExceptionLimit.getError();
    }
    limits.setKey(totalWarnLimit);
    limits.setValue(totalErrorLimit);

    return limits;
View Full Code Here

        double value = entry.getValue().doubleValue();
        double warnLimit = -1;
        double errorLimit = -1;
        if (m_configManager != null) {
          ExceptionLimit exceptionLimit = m_configManager.queryDomainExceptionLimit(m_domain, entry.getKey());
          if (exceptionLimit != null) {
            warnLimit = exceptionLimit.getWarning();
            errorLimit = exceptionLimit.getError();
          }
        }
        if (errorLimit > 0 && value >= errorLimit) {
          sb.append(buildErrorText(entry.getKey() + " " + value, ERROR_COLOR)).append("<br/>");
        } else if (warnLimit > 0 && value >= warnLimit) {
View Full Code Here

    public void setValue(double value) {
      m_value = value;
      double warningLimit = -1;
      double errorLimit = -1;
      if (m_configManager != null) {
        ExceptionLimit totalLimit = m_configManager.queryDomainTotalLimit(m_domain);
        if (totalLimit != null) {
          warningLimit = totalLimit.getWarning();
          errorLimit = totalLimit.getError();
        }
      }
      if (errorLimit > 0 && value > errorLimit) {
        m_alert = 2;
      } else if (warningLimit > 0 && value > warningLimit) {
View Full Code Here

    }
    m_exceptionConfigManager.insertExceptionExclude(exclude);
  }

  private void updateExceptionLimit(Payload payload) {
    ExceptionLimit limit = payload.getExceptionLimit();
    m_exceptionConfigManager.insertExceptionLimit(limit);
  }
View Full Code Here

    }

    int warnLimit = -1;
    int errorLimit = -1;
    int count = error.getCount();
    ExceptionLimit exceptionLimit = m_exceptionConfigManager
          .queryDomainExceptionLimit(m_currentDomain, error.getId());

    m_totalSegmentException += count;

    if (exceptionLimit != null) {
      warnLimit = exceptionLimit.getWarning();
      errorLimit = exceptionLimit.getError();
    }

    if (errorLimit > 0 & warnLimit > 0 & count >= Math.min(warnLimit, errorLimit)) {

      com.dianping.cat.home.alert.report.entity.Domain domain = m_report.findOrCreateDomain(m_currentDomain);
View Full Code Here

  public void visitSegment(Segment segment) {
    m_totalSegmentException = 0;

    super.visitSegment(segment);

    ExceptionLimit exceptionLimit = m_exceptionConfigManager.queryDomainTotalLimit(m_currentDomain);
    int warnLimit = -1;
    int errorLimit = -1;

    if (exceptionLimit != null) {
      warnLimit = exceptionLimit.getWarning();
      errorLimit = exceptionLimit.getError();
    }

    if (errorLimit > 0 & warnLimit > 0 & m_totalSegmentException >= Math.min(warnLimit, errorLimit)) {
      com.dianping.cat.home.alert.report.entity.Domain domain = m_report.findOrCreateDomain(m_currentDomain);
      com.dianping.cat.home.alert.report.entity.Exception exception = domain
View Full Code Here

    return result;
  }

  public ExceptionLimit queryDomainExceptionLimit(String domain, String exceptionName) {
    DomainConfig domainConfig = m_exceptionConfig.getDomainConfigs().get(domain);
    ExceptionLimit result = null;
   
    if (domainConfig == null) {
      domainConfig = m_exceptionConfig.getDomainConfigs().get(DEFAULT_STRING);
    }
    if (domainConfig != null) {
View Full Code Here

TOP

Related Classes of com.dianping.cat.home.dependency.exception.entity.ExceptionLimit

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.