當前位置: 首頁>>代碼示例>>Java>>正文


Java VerifiableProperties.getString方法代碼示例

本文整理匯總了Java中kafka.utils.VerifiableProperties.getString方法的典型用法代碼示例。如果您正苦於以下問題:Java VerifiableProperties.getString方法的具體用法?Java VerifiableProperties.getString怎麽用?Java VerifiableProperties.getString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在kafka.utils.VerifiableProperties的用法示例。


在下文中一共展示了VerifiableProperties.getString方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import kafka.utils.VerifiableProperties; //導入方法依賴的package包/類
@Override
public synchronized void init(VerifiableProperties props) {
    if (!initialized) {
        KafkaMetricsConfig metricsConfig = new KafkaMetricsConfig(props);
        influxDBAddress = props.getString("kafka.influxdb.metrics.address", INFLUXDB_DEFAULT_ADDRESS);
        influxDBUsername = props.getString("kafka.influxdb.metrics.username", INFLUXDB_DEFAULT_USERNAME);
        influxDBPassword = props.getString("kafka.influxdb.metrics.password", INFLUXDB_DEFAULT_PASSWORD);
        influxDBConsistency = props.getString("kafka.influxdb.metrics.consistency", INFLUXDB_DEFAULT_CONSISTENCY);
        influxDBDatabase = props.getString("kafka.influxdb.metrics.database", INFLUXDB_DEFAULT_DATABASE);
        influxDBRetentionPolicy = props.getString("kafka.influxdb.metrics.retentionPolicy", INFLUXDB_DEFAULT_RETENTIONPOLICY);
        influxDBTags = props.getString("kafka.influxdb.metrics.tags", INFLUXDB_DEFAULT_TAGS);
        metricDimensions = Dimension.fromProperties(props.props(), "kafka.influxdb.dimension.enabled.");

        LOG.debug("Initialize InfluxDBReporter [{},{},{}]", influxDBAddress, influxDBDatabase, influxDBRetentionPolicy);

        reporter = buildInfluxDBReporter();

        if (props.getBoolean("kafka.influxdb.metrics.reporter.enabled", false)) {
            initialized = true;
            startReporter(metricsConfig.pollingIntervalSecs());
            LOG.debug("InfluxDBReporter started.");
        }
    }
}
 
開發者ID:jasper-zhang,項目名稱:kafka-influxdb,代碼行數:25,代碼來源:KafkaInfluxDBMetricsReporter.java

示例2: init

import kafka.utils.VerifiableProperties; //導入方法依賴的package包/類
@Override
public synchronized void init(VerifiableProperties props) {
    if (!initialized) {
        KafkaMetricsConfig metricsConfig = new KafkaMetricsConfig(props);
        graphiteHost = props.getString("kafka.graphite.metrics.host", GRAPHITE_DEFAULT_HOST);
        graphitePort = props.getInt("kafka.graphite.metrics.port", GRAPHITE_DEFAULT_PORT);
        metricPrefix = props.getString("kafka.graphite.metrics.group", GRAPHITE_DEFAULT_PREFIX);
        String excludeRegex = props.getString("kafka.graphite.metrics.exclude.regex", null);
        metricDimensions = Dimension.fromProperties(props.props(), "kafka.graphite.dimension.enabled.");

        LOG.debug("Initialize GraphiteReporter [{},{},{}]", graphiteHost, graphitePort, metricPrefix);

        if (excludeRegex != null) {
            LOG.debug("Using regex [{}] for GraphiteReporter", excludeRegex);
            metricPredicate = new FilterMetricPredicate(excludeRegex);
        }
        reporter = buildGraphiteReporter();

        if (props.getBoolean("kafka.graphite.metrics.reporter.enabled", false)) {
            initialized = true;
            startReporter(metricsConfig.pollingIntervalSecs());
            LOG.debug("GraphiteReporter started.");
        }
    }
}
 
開發者ID:damienclaveau,項目名稱:kafka-graphite,代碼行數:26,代碼來源:KafkaGraphiteMetricsReporter.java

示例3: loadConfig

import kafka.utils.VerifiableProperties; //導入方法依賴的package包/類
private void loadConfig(VerifiableProperties props) {
  enabled = props.getBoolean("external.kafka.statsd.reporter.enabled", false);
  host = props.getString("external.kafka.statsd.host", "localhost");
  port = props.getInt("external.kafka.statsd.port", 8125);
  prefix = props.getString("external.kafka.statsd.metrics.prefix", "");
  pollingPeriodInSeconds = props.getInt("kafka.metrics.polling.interval.secs", 10);
  metricDimensions = Dimension.fromProperties(props.props(), "external.kafka.statsd.dimension.enabled.");

  String excludeRegex = props.getString("external.kafka.statsd.metrics.exclude_regex", DEFAULT_EXCLUDE_REGEX);
  if (excludeRegex != null && excludeRegex.length() != 0) {
    metricPredicate = new ExcludeMetricPredicate(excludeRegex);
  } else {
    metricPredicate = MetricPredicate.ALL;
  }

  this.isTagEnabled = props.getBoolean("external.kafka.statsd.tag.enabled", true);
}
 
開發者ID:airbnb,項目名稱:kafka-statsd-metrics2,代碼行數:18,代碼來源:StatsdMetricsReporter.java

示例4: InfluxDBMetricsConfig

import kafka.utils.VerifiableProperties; //導入方法依賴的package包/類
/**
 * Creates a new {@link InfluxDBMetricsConfig} instance.
 *
 * @param props  The Kafka configuration.
 */
InfluxDBMetricsConfig(VerifiableProperties props) {
    this.connectString = props.getString(KAFKA_INFLUX_METRICS_CONNECT_CONFIG, "http://localhost:8086");
    this.database = props.getString(KAFKA_INFLUX_METRICS_DATABASE_CONFIG, "kafka");
    this.username = props.getString(KAFKA_INFLUX_METRICS_USERNAME_CONFIG, "root");
    this.password = props.getString(KAFKA_INFLUX_METRICS_PASSWORD_CONFIG, "root");
    if( props.containsKey(KAFKA_INFLUX_METRICS_CONSISTENCY_CONFIG) )
        this.consistency = props.getString(KAFKA_INFLUX_METRICS_CONSISTENCY_CONFIG);
    if( props.containsKey(KAFKA_INFLUX_METRICS_TAGS_CONFIG) ) {
        this.retention = props.getString(KAFKA_INFLUX_METRICS_RETENTION_CONFIG);
        checkRetentionPolicies();
    }
    setAdditionalTags(props);
    setMeasuresFilters(props);
}
 
開發者ID:fhussonnois,項目名稱:kafka-influxdb-reporter,代碼行數:20,代碼來源:InfluxDBMetricsConfig.java

示例5: setAdditionalTags

import kafka.utils.VerifiableProperties; //導入方法依賴的package包/類
private void setAdditionalTags(VerifiableProperties props) {
    String tags = props.getString(KAFKA_INFLUX_METRICS_TAGS_CONFIG, null);
    if( tags != null) {
        for(String tag : tags.split(",") ) {
            String[] tagAndValue = tag.split("=");
            addTag(tagAndValue[0], tagAndValue[1]);
        }
    }
}
 
開發者ID:fhussonnois,項目名稱:kafka-influxdb-reporter,代碼行數:10,代碼來源:InfluxDBMetricsConfig.java

示例6: init

import kafka.utils.VerifiableProperties; //導入方法依賴的package包/類
@Override
public synchronized void init(VerifiableProperties props) {
	if (!initialized) {
		KafkaMetricsConfig metricsConfig = new KafkaMetricsConfig(props);
		statsdHost = props.getString("kafka.statsd.metrics.host", STATSD_DEFAULT_HOST).trim();
		statsdPort = props.getInt("kafka.statsd.metrics.port", STATSD_DEFAULT_PORT);
		statsdGroupPrefix = props.getString("kafka.statsd.metrics.group", STATSD_DEFAULT_PREFIX).trim();
           String regex = props.getString("kafka.statsd.metrics.exclude.regex", null);

           LOG.debug("Initialize StatsdReporter ["+statsdHost+","+statsdPort+","+statsdGroupPrefix+"]");

           if (regex != null) {
           	predicate = new RegexMetricPredicate(regex);
           }
           try {
           	reporter = new StatsdReporter(
           			Metrics.defaultRegistry(),
           			statsdGroupPrefix,
           			predicate,
           			statsdHost,
           			statsdPort,
           			Clock.defaultClock()
           			);
           } catch (IOException e) {
           	LOG.error("Unable to initialize StatsdReporter", e);
           }
           if (props.getBoolean("kafka.statsd.metrics.reporter.enabled", false)) {
           	initialized = true;
           	startReporter(metricsConfig.pollingIntervalSecs());
               LOG.debug("StatsdReporter started.");
           }
       }
   }
 
開發者ID:myfitnesspal,項目名稱:kafka-statsd-reporter,代碼行數:34,代碼來源:KafkaStatsdMetricsReporter.java

示例7: init

import kafka.utils.VerifiableProperties; //導入方法依賴的package包/類
@Override
public synchronized void init(VerifiableProperties props) {
    if (!initialized) {
        KafkaMetricsConfig metricsConfig = new KafkaMetricsConfig(props);
        graphiteHost = props.getString("kafka.graphite.metrics.host", GRAPHITE_DEFAULT_HOST);
        graphitePort = props.getInt("kafka.graphite.metrics.port", GRAPHITE_DEFAULT_PORT);
        graphiteGroupPrefix = props.getString("kafka.graphite.metrics.env", GRAPHITE_DEFAULT_PREFIX);
        
        System.setProperty("kafka.graphite.metrics.log.debug",
                props.getString("kafka.graphite.metrics.log.debug", "false"));
        System.setProperty("zookeeper.connect", props.getString("zookeeper.connect", "localhost:2181"));
        System.setProperty("kafka.http.status.port", props.getString("kafka.http.status.port", "6091"));
        System.setProperty("kafka.http.status.port", props.getString("kafka.http.status.port", "6091"));
        System.setProperty("kafka.broker.datacenter", props.getString("kafka.broker.datacenter", "default"));
        System.setProperty("kafka.broker.stats.sender", props.getString("kafka.broker.stats.sender", "false"));
        hostMatch = props.getString("kafka.broker.stats.sender", "");

        try {
            graphiteSuffix = InetAddress.getLocalHost().getHostName().toLowerCase();
            if (graphiteSuffix.contains(".")) {
                String[] parts = graphiteSuffix.split("\\.");
                graphiteSuffix = parts[0];
            }
        } catch (UnknownHostException e1) {
            LOG.error(e1);
        }
        String regex = props.getString("kafka.graphite.metrics.exclude.regex", null);

        LOG.info("Initialize GraphiteReporter [" + graphiteHost + "," + graphitePort + "," + graphiteGroupPrefix + "," + hostMatch + "]");

        if (regex != null) {
            predicate = new RegexMetricPredicate(regex);
        }
        try {
            reporter = new GraphiteReporter(Metrics.defaultRegistry(), graphiteHost, graphitePort, graphiteGroupPrefix,
                    graphiteSuffix
            );
        } catch (IOException e) {
            LOG.error("Unable to initialize GraphiteReporter", e);
        }
        if (props.getBoolean("kafka.graphite.metrics.reporter.enabled", false)) {
            initialized = true;
            startReporter(metricsConfig.pollingIntervalSecs());
            LOG.debug("GraphiteReporter started.");
        }
    }
}
 
開發者ID:krux,項目名稱:kafka-metrics-reporter,代碼行數:48,代碼來源:KafkaGraphiteMetricsReporter.java

示例8: SyncProducerConfig

import kafka.utils.VerifiableProperties; //導入方法依賴的package包/類
public SyncProducerConfig(VerifiableProperties props) {
    super(props);
    host = props.getString("host");
    port = props.getInt("port");
}
 
開發者ID:bingoohuang,項目名稱:buka,代碼行數:6,代碼來源:SyncProducerConfig.java

示例9: StringDecoder

import kafka.utils.VerifiableProperties; //導入方法依賴的package包/類
public StringDecoder(VerifiableProperties props) {
    this.props = props;

    encoding = (props == null) ? "UTF8" : props.getString("serializer.encoding", "UTF8");
}
 
開發者ID:bingoohuang,項目名稱:buka,代碼行數:6,代碼來源:StringDecoder.java

示例10: StringEncoder

import kafka.utils.VerifiableProperties; //導入方法依賴的package包/類
public StringEncoder(VerifiableProperties props) {
    this.props = props;
    encoding = props == null ? "UTF8" : props.getString("serializer.encoding", "UTF8");

}
 
開發者ID:bingoohuang,項目名稱:buka,代碼行數:6,代碼來源:StringEncoder.java


注:本文中的kafka.utils.VerifiableProperties.getString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。