Package com.dianping.cat.agent.monitor

Examples of com.dianping.cat.agent.monitor.DataEntity


  protected List<DataEntity> buildEntities(Map<String, Double> values, String type) {
    ArrayList<DataEntity> entities = new ArrayList<DataEntity>();
    long time = System.currentTimeMillis();

    for (Entry<String, Double> entry : values.entrySet()) {
      DataEntity entity = new DataEntity();
      String key = entry.getKey();
      double value = entry.getValue();

      entity.setId(key).setType(type).setTime(time).setValue(value);
      addGroupDomainInfo(entity);
      entities.add(entity);
    }
    return entities;
  }
View Full Code Here


    return "system-" + domain;
  }

  private DataEntity buildMd5Info(String domain, String type, String realKey, String key, String value) {
    String md5Info = findOrCreateMd5Info(key);
    DataEntity entity = null;

    if (StringUtils.isNotEmpty(md5Info)) {
      entity = new DataEntity();
      entity.setGroup(buildGroup(domain)).setDomain(domain).setId(realKey).setTime(System.currentTimeMillis())
            .setType(type);
      if (md5Info.equals(value)) {
        entity.setValue(1);
      } else {
        entity.setValue(0);
      }
    } else {
      m_ip2Md5.put(key, value);
    }
    return entity;
View Full Code Here

    }
    return entity;
  }

  private DataEntity buildSumEntity(String domain, String type, String realKey, String key, String value) {
    DataEntity entity = null;

    try {
      double currentValue = Double.parseDouble(value);
      double lastValue = findOrCreateSumValue(key);

      if (lastValue >= 0) {
        double gap = currentValue - lastValue;
        entity = new DataEntity();

        entity.setGroup(buildGroup(domain)).setDomain(domain).setId(realKey).setTime(System.currentTimeMillis())
              .setType(type).setValue(gap);
      }
      m_lastValues.put(key, currentValue);
    } catch (Exception e) {
      Cat.logError(e);
View Full Code Here

        String realKey = key.substring(0, typeIndex >= 0 ? typeIndex : 0);

        if (line.startsWith("domain")) {
          domain = value;
        } else if ("sum".equals(type)) {
          DataEntity inFlow = buildSumEntity(domain, type, realKey, key, value);

          add2Entities(dataEntities, inFlow);
        } else if (line.startsWith("system_md5Change")) {
          DataEntity md5Info = buildMd5Info(domain, type, realKey, key, value);

          add2Entities(dataEntities, md5Info);
        } else if ("avg".equals(type)) {
          DataEntity entity = new DataEntity();

          entity.setGroup("system-" + domain).setDomain(domain).setId(realKey).setTime(System.currentTimeMillis())
                .setType(type).setValue(Double.parseDouble(value));
          dataEntities.add(entity);
        }
      } catch (Exception e) {
        Cat.logError(e);
View Full Code Here

TOP

Related Classes of com.dianping.cat.agent.monitor.DataEntity

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.