@Override public void processCounter(MetricName metricName, Counter counter, Context context) { if (MetricsUtils.isInterested(metricName)) { LOG.warn("Not processing metric {} of type Counter.", metricName); } }
private void addMetricIfInterested(KafkaMetric metric) { LOG.trace("Checking Kafka metric {}", metric.metricName()); if (MetricsUtils.isInterested(metric.metricName())) { LOG.debug("Added new metric {} to Cruise Control metrics reporter.", metric.metricName()); _interestedMetrics.put(metric.metricName(), metric); } }
@Override public void processGauge(MetricName metricName, Gauge<?> gauge, Context context) { if (MetricsUtils.isInterested(metricName)) { LOG.trace("Processing metric {} of type Gauge.", metricName); if (!(gauge.value() instanceof Number)) { throw new IllegalStateException(String.format("The value of yammer metric %s is %s, which is not a number", metricName, gauge.value())); } CruiseControlMetric ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, ((Number) gauge.value()).doubleValue()); context.reporter().sendCruiseControlMetric(ccm); } }
/** * Check if a kafkaMetric is an interested metric. */ public static boolean isInterested(org.apache.kafka.common.MetricName metricName) { String group = metricName.group(); String name = metricName.name(); String type = metricName.tags().get(TYPE_KEY); return isInterested(group, name, type, metricName.tags()); }
@Override public void processMeter(MetricName metricName, Metered metered, Context context) { if (MetricsUtils.isInterested(metricName)) { LOG.trace("Processing metric {} of type Meter.", metricName); double value; if (context.reportingInterval() <= 60000L) { value = metered.oneMinuteRate(); } else if (context.reportingInterval() <= 300000) { value = metered.fiveMinuteRate(); } else { value = metered.fifteenMinuteRate(); } CruiseControlMetric ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, value); context.reporter().sendCruiseControlMetric(ccm); } }
/** * Check if a yammer metric name is an interested metric */ public static boolean isInterested(com.yammer.metrics.core.MetricName metricName) { return isInterested(metricName.getGroup(), metricName.getName(), metricName.getType(), yammerMetricScopeToTags(metricName.getScope())); }
@Override public void processHistogram(MetricName metricName, Histogram histogram, Context context) { if (MetricsUtils.isInterested(metricName)) { LOG.trace("Processing metric {} of type Histogram.", metricName);
@Override public void processTimer(MetricName metricName, Timer timer, Context context) { if (MetricsUtils.isInterested(metricName)) { LOG.trace("Processing metric {} of type Timer.", metricName);
@Override public void processCounter(MetricName metricName, Counter counter, Context context) { if (MetricsUtils.isInterested(metricName)) { LOG.warn("Not processing metric {} of type Counter.", metricName); } }
private void addMetricIfInterested(KafkaMetric metric) { LOG.trace("Checking Kafka metric {}", metric.metricName()); if (MetricsUtils.isInterested(metric.metricName())) { LOG.debug("Added new metric {} to Cruise Control metrics reporter.", metric.metricName()); _interestedMetrics.put(metric.metricName(), metric); } }
@Override public void processGauge(MetricName metricName, Gauge<?> gauge, Context context) { if (MetricsUtils.isInterested(metricName)) { LOG.trace("Processing metric {} of type Gauge.", metricName); if (!(gauge.value() instanceof Number)) { throw new IllegalStateException(String.format("The value of yammer metric %s is %s, which is not a number", metricName, gauge.value())); } CruiseControlMetric ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, ((Number) gauge.value()).doubleValue()); context.reporter().sendCruiseControlMetric(ccm); } }
/** * Check if a kafkaMetric is an interested metric. */ public static boolean isInterested(org.apache.kafka.common.MetricName metricName) { String group = metricName.group(); String name = metricName.name(); String type = metricName.tags().get(TYPE_KEY); return isInterested(group, name, type, metricName.tags()); }
@Override public void processMeter(MetricName metricName, Metered metered, Context context) { if (MetricsUtils.isInterested(metricName)) { LOG.trace("Processing metric {} of type Meter.", metricName); double value; if (context.reportingInterval() <= 60000L) { value = metered.oneMinuteRate(); } else if (context.reportingInterval() <= 300000) { value = metered.fiveMinuteRate(); } else { value = metered.fifteenMinuteRate(); } CruiseControlMetric ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, value); context.reporter().sendCruiseControlMetric(ccm); } }
/** * Check if a yammer metric name is an interested metric */ public static boolean isInterested(com.yammer.metrics.core.MetricName metricName) { return isInterested(metricName.getGroup(), metricName.getName(), metricName.getType(), yammerMetricScopeToTags(metricName.getScope())); }
@Override public void processHistogram(MetricName metricName, Histogram histogram, Context context) { if (MetricsUtils.isInterested(metricName)) { LOG.trace("Processing metric {} of type Histogram.", metricName);
@Override public void processTimer(MetricName metricName, Timer timer, Context context) { if (MetricsUtils.isInterested(metricName)) { LOG.trace("Processing metric {} of type Timer.", metricName);