本文整理汇总了Java中kafka.metrics.KafkaMetricsConfig类的典型用法代码示例。如果您正苦于以下问题:Java KafkaMetricsConfig类的具体用法?Java KafkaMetricsConfig怎么用?Java KafkaMetricsConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KafkaMetricsConfig类属于kafka.metrics包,在下文中一共展示了KafkaMetricsConfig类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: init
import kafka.metrics.KafkaMetricsConfig; //导入依赖的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.metrics.KafkaMetricsConfig; //导入依赖的package包/类
@Override
public void init(VerifiableProperties props) {
if(!initialized) {
KafkaMetricsConfig metricsConfig = new KafkaMetricsConfig(props);
InfluxDBMetricsConfig config = new InfluxDBMetricsConfig(props);
config.addTag("brokerId", props.getString("broker.id"));
this.reporter = new InfluxReporter(Metrics.defaultRegistry(), DEFAULT_NAME
,new InfluxDBClient(config), new MetricsPredicate(config.getPredicates()));
if (props.getBoolean(InfluxDBMetricsConfig.KAFKA_INFLUX_METRICS_ENABLE, false)) {
initialized = true;
startReporter(metricsConfig.pollingIntervalSecs());
LOG.info("KafkaInfluxMetricsReporter initialized.");
}
}
}
开发者ID:fhussonnois,项目名称:kafka-influxdb-reporter,代码行数:20,代码来源:KafkaInfluxMetricsReporter.java
示例3: init
import kafka.metrics.KafkaMetricsConfig; //导入依赖的package包/类
@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");
}
}
开发者ID:arnobroekhof,项目名称:kafka-http-metrics-reporter,代码行数:23,代码来源:KafkaHttpMetricsReporter.java
示例4: init
import kafka.metrics.KafkaMetricsConfig; //导入依赖的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
示例5: init
import kafka.metrics.KafkaMetricsConfig; //导入依赖的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
示例6: init
import kafka.metrics.KafkaMetricsConfig; //导入依赖的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
注:本文中的kafka.metrics.KafkaMetricsConfig类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论