public StringPartitioner(VerifiableProperties props) { this.numPartitions = Integer.parseInt(props.getProperty(Constants.Logging.NUM_PARTITIONS)); Preconditions.checkArgument(this.numPartitions > 0, "numPartitions should be at least 1. Got %s", this.numPartitions); }
public StringPartitioner(VerifiableProperties props) { this.numPartitions = Integer.parseInt(props.getProperty(Constants.Logging.NUM_PARTITIONS)); Preconditions.checkArgument(this.numPartitions > 0, "numPartitions should be at least 1. Got %s", this.numPartitions); }
@Override public void init(VerifiableProperties verifiableProperties) { if (!initialized) { // get configured metrics from kafka KafkaMetricsConfig metricsConfig = new KafkaMetricsConfig(verifiableProperties); // get the configured properties from kafka to set the bindAddress and port. bindAddress = verifiableProperties.getProperty("kafka.http.metrics.host"); port = Integer.parseInt(verifiableProperties.getProperty("kafka.http.metrics.port")); enabled = Boolean.parseBoolean(verifiableProperties.getProperty("kafka.http.metrics.reporter.enabled")); // construct the Metrics Server metricsServer = new KafkaHttpMetricsServer(bindAddress, port); initialized = true; // call the method startReporter startReporter(metricsConfig.pollingIntervalSecs()); } else { LOG.error("Kafka Http Metrics Reporter already initialized"); } }
@Override public void init(VerifiableProperties props) { if (!initialized) { this.props = new Properties(); if (props.containsKey(CONFIG_POLLING_INTERVAL)) { this.pollingIntervalSeconds = props.getInt(CONFIG_POLLING_INTERVAL); } else { this.pollingIntervalSeconds = 10; } this.brokerId = Integer.parseInt(props.getProperty("broker.id")); log.info("Building ConsumerGroupReporter: polling.interval=" + pollingIntervalSeconds); Enumeration<Object> keys = props.props().keys(); while (keys.hasMoreElements()) { String key = keys.nextElement().toString(); if (key.startsWith("kafka.metrics.")) { String subKey = key.substring(14); this.props.put(subKey, props.props().get(key)); log.info("Building ConsumerGroupReporter: " + subKey + "=" + this.props.get(subKey)); } } initialized = true; this.underlying = new X(Metrics.defaultRegistry()); startReporter(pollingIntervalSeconds); } }