Пример #1
0
 private static List<MetricInfo> parseMetrics(String rawMetricStr) {
   try {
     return Resources.jsonMapper.readValue(rawMetricStr, new TypeReference<List<MetricInfo>>() {});
   } catch (Exception e) {
     log.error(e, "failed to parse metric infos");
     return Collections.emptyList();
   }
 }
Пример #2
0
 void checkAlarm(MetricInfo info, Map<String, String> tags) {
   boolean shouldWarn = false;
   if (watcher == Watcher.ShouldBigger) {
     shouldWarn = info.value < threshold;
   } else if (watcher == Watcher.ShouldSmaller) {
     shouldWarn = info.value > threshold;
   }
   if (shouldWarn && Config.config.druidInfos.shouldWarn(info.metric)) {
     String warnMsg = getWarning(info, tags);
     Utils.sendNotify("druid", warnMsg);
     log.warn("druid - " + warnMsg);
   }
 }