/** * build a CruiseControlMetric object. */ private static CruiseControlMetric toCruiseControlMetric(long now, int brokerId, String name, Map<String, String> tags, double value) { return toCruiseControlMetric(now, brokerId, name, tags, value, null); }
/** * Convert a Yammer metric to a CruiseControlMetric */ public static CruiseControlMetric toCruiseControlMetric(long now, int brokerId, com.yammer.metrics.core.MetricName metricName, double value) { return toCruiseControlMetric(now, brokerId, metricName, value, null); }
private void reportKafkaMetrics(long now) { LOG.debug("Reporting KafkaMetrics. {}", _interestedMetrics.values()); for (KafkaMetric metric : _interestedMetrics.values()) { sendCruiseControlMetric(MetricsUtils.toCruiseControlMetric(metric, now, _brokerId)); } LOG.debug("Finished reporting KafkaMetrics."); }
/** * Convert a Yammer metric to a CruiseControlMetric */ public static CruiseControlMetric toCruiseControlMetric(long now, int brokerId, com.yammer.metrics.core.MetricName metricName, double value, String attribute) { CruiseControlMetric ccm = toCruiseControlMetric(now, brokerId, metricName.getName(), yammerMetricScopeToTags(metricName.getScope()), value, attribute); if (ccm == null) { throw new IllegalArgumentException(String.format("Cannot convert yammer metric %s to a Cruise Control metric for " + "broker %d at time %d for tag %s", metricName, brokerId, now, attribute)); } return ccm; }
@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); } }
/** * Convert a KafkaMetric to a CruiseControlMetric */ public static CruiseControlMetric toCruiseControlMetric(KafkaMetric kafkaMetric, long now, int brokerId) { org.apache.kafka.common.MetricName metricName = kafkaMetric.metricName(); CruiseControlMetric ccm = toCruiseControlMetric(now, brokerId, metricName.name(), metricName.tags(), kafkaMetric.value()); if (ccm == null) { throw new IllegalArgumentException(String.format("Cannot convert KafkaMetric %s to a Cruise Control metric for " + "broker %d at time %d", kafkaMetric.metricName(), brokerId, now)); } return ccm; }
LOG.trace("Processing metric {} of type Histogram.", metricName); CruiseControlMetric ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName,
LOG.trace("Processing metric {} of type Timer.", metricName); CruiseControlMetric ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, context.reporter().sendCruiseControlMetric(ccm); ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, context.reporter().sendCruiseControlMetric(ccm); ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName,
@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); } }
/** * build a CruiseControlMetric object. */ private static CruiseControlMetric toCruiseControlMetric(long now, int brokerId, String name, Map<String, String> tags, double value) { return toCruiseControlMetric(now, brokerId, name, tags, value, null); }
/** * Convert a Yammer metric to a CruiseControlMetric */ public static CruiseControlMetric toCruiseControlMetric(long now, int brokerId, com.yammer.metrics.core.MetricName metricName, double value) { return toCruiseControlMetric(now, brokerId, metricName, value, null); }
private void reportKafkaMetrics(long now) { LOG.debug("Reporting KafkaMetrics. {}", _interestedMetrics.values()); for (KafkaMetric metric : _interestedMetrics.values()) { sendCruiseControlMetric(MetricsUtils.toCruiseControlMetric(metric, now, _brokerId)); } LOG.debug("Finished reporting KafkaMetrics."); }
/** * Convert a Yammer metric to a CruiseControlMetric */ public static CruiseControlMetric toCruiseControlMetric(long now, int brokerId, com.yammer.metrics.core.MetricName metricName, double value, String attribute) { CruiseControlMetric ccm = toCruiseControlMetric(now, brokerId, metricName.getName(), yammerMetricScopeToTags(metricName.getScope()), value, attribute); if (ccm == null) { throw new IllegalArgumentException(String.format("Cannot convert yammer metric %s to a Cruise Control metric for " + "broker %d at time %d for tag %s", metricName, brokerId, now, attribute)); } return ccm; }
@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); } }
/** * Convert a KafkaMetric to a CruiseControlMetric */ public static CruiseControlMetric toCruiseControlMetric(KafkaMetric kafkaMetric, long now, int brokerId) { org.apache.kafka.common.MetricName metricName = kafkaMetric.metricName(); CruiseControlMetric ccm = toCruiseControlMetric(now, brokerId, metricName.name(), metricName.tags(), kafkaMetric.value()); if (ccm == null) { throw new IllegalArgumentException(String.format("Cannot convert KafkaMetric %s to a Cruise Control metric for " + "broker %d at time %d", kafkaMetric.metricName(), brokerId, now)); } return ccm; }
LOG.trace("Processing metric {} of type Histogram.", metricName); CruiseControlMetric ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName,
LOG.trace("Processing metric {} of type Timer.", metricName); CruiseControlMetric ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, context.reporter().sendCruiseControlMetric(ccm); ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, context.reporter().sendCruiseControlMetric(ccm); ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName, ccm = MetricsUtils.toCruiseControlMetric(context.time(), context.brokerId(), metricName,
@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); } }