本文整理汇总了Java中org.apache.fluo.api.config.SimpleConfiguration.getBoolean方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleConfiguration.getBoolean方法的具体用法?Java SimpleConfiguration.getBoolean怎么用?Java SimpleConfiguration.getBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.fluo.api.config.SimpleConfiguration
的用法示例。
在下文中一共展示了SimpleConfiguration.getBoolean方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: start
import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
@Override
public List<AutoCloseable> start(Params params) {
SimpleConfiguration config =
new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("graphite");
if (!config.getBoolean("enable", false)) {
return Collections.emptyList();
}
String host = config.getString("host");
String prefix = config.getString("prefix", "");
int port = config.getInt("port", 8080);
TimeUnit rateUnit = TimeUnit.valueOf(config.getString("rateUnit", "seconds").toUpperCase());
TimeUnit durationUnit =
TimeUnit.valueOf(config.getString("durationUnit", "milliseconds").toUpperCase());
Graphite graphite = new Graphite(host, port);
GraphiteReporter reporter =
GraphiteReporter.forRegistry(params.getMetricRegistry()).convertDurationsTo(durationUnit)
.convertRatesTo(rateUnit).prefixedWith(prefix).build(graphite);
reporter.start(config.getInt("frequency", 60), TimeUnit.SECONDS);
log.info("Reporting metrics to graphite server {}:{}", host, port);
return Collections.singletonList((AutoCloseable) reporter);
}
示例2: start
import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
@Override
public List<AutoCloseable> start(Params params) {
SimpleConfiguration config =
new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("console");
if (!config.getBoolean("enable", false)) {
return Collections.emptyList();
}
TimeUnit rateUnit = TimeUnit.valueOf(config.getString("rateUnit", "seconds").toUpperCase());
TimeUnit durationUnit =
TimeUnit.valueOf(config.getString("durationUnit", "milliseconds").toUpperCase());
PrintStream out = System.out;
if (config.getString("target", "stdout").equals("stderr")) {
out = System.err;
}
ConsoleReporter reporter = ConsoleReporter.forRegistry(params.getMetricRegistry())
.convertDurationsTo(durationUnit).convertRatesTo(rateUnit).outputTo(out).build();
reporter.start(config.getInt("frequency", 60), TimeUnit.SECONDS);
log.info("Reporting metrics to console");
return Collections.singletonList((AutoCloseable) reporter);
}
示例3: start
import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
@Override
public List<AutoCloseable> start(Params params) {
SimpleConfiguration config =
new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("slf4j");
if (!config.getBoolean("enable", false)) {
return Collections.emptyList();
}
TimeUnit rateUnit = TimeUnit.valueOf(config.getString("rateUnit", "seconds").toUpperCase());
TimeUnit durationUnit =
TimeUnit.valueOf(config.getString("durationUnit", "milliseconds").toUpperCase());
Logger logger = LoggerFactory.getLogger(config.getString("logger", "metrics"));
Slf4jReporter reporter = Slf4jReporter.forRegistry(params.getMetricRegistry())
.convertDurationsTo(durationUnit).convertRatesTo(rateUnit).outputTo(logger).build();
reporter.start(config.getInt("frequency", 60), TimeUnit.SECONDS);
log.info("Reporting metrics using slf4j");
return Collections.singletonList((AutoCloseable) reporter);
}
示例4: start
import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
@Override
public List<AutoCloseable> start(Params params) {
SimpleConfiguration config =
new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("csv");
String dir = config.getString("dir", "");
if (!config.getBoolean("enable", false) || dir.isEmpty()) {
return Collections.emptyList();
}
TimeUnit rateUnit = TimeUnit.valueOf(config.getString("rateUnit", "seconds").toUpperCase());
TimeUnit durationUnit =
TimeUnit.valueOf(config.getString("durationUnit", "milliseconds").toUpperCase());
CsvReporter reporter = CsvReporter.forRegistry(params.getMetricRegistry())
.convertDurationsTo(durationUnit).convertRatesTo(rateUnit).build(new File(dir));
reporter.start(config.getInt("frequency", 60), TimeUnit.SECONDS);
log.info("Reporting metrics as csv to directory {}", dir);
return Collections.singletonList((AutoCloseable) reporter);
}
示例5: start
import org.apache.fluo.api.config.SimpleConfiguration; //导入方法依赖的package包/类
@Override
public List<AutoCloseable> start(Params params) {
SimpleConfiguration config =
new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("jmx");
if (!config.getBoolean("enable", false)) {
return Collections.emptyList();
}
TimeUnit rateUnit = TimeUnit.valueOf(config.getString("rateUnit", "seconds").toUpperCase());
TimeUnit durationUnit =
TimeUnit.valueOf(config.getString("durationUnit", "milliseconds").toUpperCase());
JmxReporter reporter =
JmxReporter.forRegistry(params.getMetricRegistry()).convertDurationsTo(durationUnit)
.convertRatesTo(rateUnit).inDomain(params.getDomain()).build();
reporter.start();
log.info("Reporting metrics to JMX");
return Collections.singletonList((AutoCloseable) reporter);
}