Package com.dianping.cat.advanced.metric.config.entity

Examples of com.dianping.cat.advanced.metric.config.entity.MetricItemConfig


  private static final int POINT_NUMBER = 60 * 24;

  protected void buildDailyReportInternal(Map<String, MetricReport> reports, String reportName, String metricId,
        Date reportPeriod) {
    MetricItemConfig metricConfig = m_configManager.getMetricConfig().getMetricItemConfigs().get(metricId);
    String metricDomain = metricConfig.getDomain();
    String productLine = m_productLineConfigManager.queryProductLineByDomain(metricDomain);

    for (MetricType type : MetricType.values()) {
      String key = metricId + ":" + type;
      BaselineConfig baselineConfig = m_baselineConfigManager.queryBaseLineConfig(key);
View Full Code Here


    deleteUnusedConfig();
  }

  public boolean insertIfNotExist(String domain, String type, String metricKey, ConfigItem item) {
    String key = buildMetricKey(domain, type, metricKey);
    MetricItemConfig config = m_metricConfig.findMetricItemConfig(key);

    if (config != null) {
      return true;
    } else {
      config = new MetricItemConfig();

      config.setId(key);
      config.setDomain(domain);
      config.setType(type);
      config.setMetricKey(metricKey);
      config.setTitle(item.getTitle());
      config.setShowAvg(item.isShowAvg());
      config.setShowCount(item.isShowCount());
      config.setShowSum(item.isShowSum());
      return insertMetricItemConfig(config);
    }
  }
View Full Code Here

  public List<MetricItemConfig> queryMetricItemConfigs(Collection<String> domains) {
    List<MetricItemConfig> configs = new ArrayList<MetricItemConfig>();
    Map<String, MetricItemConfig> metricConfig = getMetricConfig().getMetricItemConfigs();

    for (Entry<String, MetricItemConfig> entry : metricConfig.entrySet()) {
      MetricItemConfig item = entry.getValue();

      if (domains.contains(item.getDomain())) {
        configs.add(item);
      }
    }
    Collections.sort(configs, new Comparator<MetricItemConfig>() {
View Full Code Here

    Assert.assertEquals(1, s_storeCount);
    manager.insertIfNotExist(domain1, "type", "metricKey", new ConfigItem());
    Assert.assertEquals(1, s_storeCount);
    manager.insertIfNotExist(domain2, "type", "metricKey", new ConfigItem());
    Assert.assertEquals(2, s_storeCount);
    manager.insertMetricItemConfig(new MetricItemConfig());
    Assert.assertEquals(3, s_storeCount);

    MetricItemConfig item = manager.queryMetricItemConfig(manager.buildMetricKey(domain1, "type", "metricKey"));
    Assert.assertEquals(true, item != null);

    manager.deleteDomainConfig(manager.buildMetricKey(domain1, "type", "metricKey"));
    Assert.assertEquals(4, s_storeCount);
    Assert.assertEquals(2, manager.getMetricConfig().getMetricItemConfigs().size());

    HashSet<String> hashSet = new HashSet<String>();
    hashSet.add(domain1);
    hashSet.add(domain2);
    List<MetricItemConfig> sets = manager.queryMetricItemConfigs(hashSet);
    Assert.assertEquals(1, sets.size());
    manager.refreshMetricConfig();
    Assert.assertEquals(1, manager.getMetricConfig().getMetricItemConfigs().size());

    String id = manager.buildMetricKey(item.getDomain(), item.getType(), item.getMetricKey());
    item.setId(id);
    Map<MetricItemConfig, Long> configs = new HashMap<MetricItemConfig, Long>();

    configs.put(item, 1L);
    configs.put(item, 2L);
    configs.put(item, 3L);
   
    Assert.assertEquals(3L, configs.get(item).longValue());
    Assert.assertEquals(1, configs.size());
   
    item = new MetricItemConfig();
    item.setId(id);
    configs.put(item, 1L);
    configs.put(item, 3L);
    Assert.assertEquals(3L, configs.get(item).longValue());
    Assert.assertEquals(1, configs.size());
  }
View Full Code Here

      Config config = new Config();

      config.setName(name);
      MetricConfig metricConfig = new MetricConfig();

      MetricItemConfig metricItemConfig = new MetricItemConfig();

      metricItemConfig.setDomain("domain");
      metricItemConfig.setMetricKey("domain:URL:metricKey");
      metricItemConfig.setType("URL");
      metricItemConfig.setMetricKey("metricKey");
      metricConfig.addMetricItemConfig(metricItemConfig);
      config.setContent(metricConfig.toString());
      config.setModifyDate(new Date());
      return config;
    }
View Full Code Here

    model.setMetricItemConfig(m_metricConfigManager.queryMetricItemConfig(key));
  }

  private boolean metricConfigAddSubmit(Payload payload, Model model) {
    MetricItemConfig config = payload.getMetricItemConfig();
    String domain = config.getDomain();
    String type = config.getType();
    String metricKey = config.getMetricKey();

    if (!StringUtil.isEmpty(domain) && !StringUtil.isEmpty(type) && !StringUtil.isEmpty(metricKey)) {
      config.setId(m_metricConfigManager.buildMetricKey(domain, type, metricKey));

      return m_metricConfigManager.insertMetricItemConfig(config);
    } else {
      return false;
    }
View Full Code Here

  private void buildLineChartTitle(List<AlertMetric> alertKeys, LineChart chart, String key) {
    int index = key.lastIndexOf(":");
    String metricId = key.substring(0, index);
    String type = key.substring(index + 1);
    MetricItemConfig config = m_metricConfigManager.queryMetricItemConfig(metricId);

    if (config != null) {
      String des = queryMetricItemDes(type);
      String title = config.getTitle() + des;

      chart.setTitle(title);
      chart.setId(metricId + ":" + type);

      if (containMetric(alertKeys, metricId)) {
View Full Code Here

    MetricItem item = new MetricItem();

    item.setProductText(product);
    item.setMetricItemText(metricKey);

    MetricItemConfig metricItem = m_metricConfigManager.queryMetricItemConfig(metricKey);
    if (metricItem != null) {
      if (metricItem.isShowAvg()) {
        item.setMonitorAvg(true);
      }
      if (metricItem.isShowCount()) {
        item.setMonitorCount(true);
      }
      if (metricItem.isShowSum()) {
        item.setMonitorSum(true);
      }
    }

    rule.addMetricItem(item);
View Full Code Here

TOP

Related Classes of com.dianping.cat.advanced.metric.config.entity.MetricItemConfig

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.