}
}
@Override
public List<com.dianping.cat.home.rule.entity.Config> queryConfigs(String product, String metricKey, MetricType type) {
Rule rule = m_config.getRules().get(metricKey);
List<com.dianping.cat.home.rule.entity.Config> configs = new ArrayList<com.dianping.cat.home.rule.entity.Config>();
if (rule == null) {
configs.add(buildDefaultConfig());
return configs;
} else {
for (MetricItem item : rule.getMetricItems()) {
if (type == MetricType.COUNT && item.isMonitorCount()) {
configs.addAll(rule.getConfigs());
break;
} else if (type == MetricType.AVG && item.isMonitorAvg()) {
configs.addAll(rule.getConfigs());
break;
} else if (type == MetricType.SUM && item.isMonitorSum()) {
configs.addAll(rule.getConfigs());
break;
} else {
Cat.logError("No Metric Type find. product:" + product + " metric key:" + metricKey,
new RuntimeException());
}
}
if (configs.size() == 0) {
configs.add(buildDefaultConfig());
} else {
Cat.logEvent("FindRule:" + getConfigName(), rule.getId(), Event.SUCCESS, product + "," + metricKey);
}
return decorateConfigOnRead(configs);
}
}