本文整理汇总了Java中com.codahale.metrics.ScheduledReporter.start方法的典型用法代码示例。如果您正苦于以下问题:Java ScheduledReporter.start方法的具体用法?Java ScheduledReporter.start怎么用?Java ScheduledReporter.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codahale.metrics.ScheduledReporter
的用法示例。
在下文中一共展示了ScheduledReporter.start方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startMetricReporting
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
/**
* Start metric reporting.
*
* @param properties configuration properties
*/
public void startMetricReporting(Properties properties) {
if (this.reportingStarted) {
LOGGER.warn("Metric reporting has already started");
return;
}
long reportInterval = Long.parseLong(properties.getProperty(ConfigurationKeys.METRICS_REPORT_INTERVAL_KEY,
ConfigurationKeys.DEFAULT_METRICS_REPORT_INTERVAL));
buildJmxMetricReporter(properties);
if (this.jmxReporter.isPresent()) {
this.jmxReporter.get().start();
}
buildFileMetricReporter(properties);
buildKafkaMetricReporter(properties);
buildCustomMetricReporters(properties);
for (ScheduledReporter reporter : this.scheduledReporters) {
reporter.start(reportInterval, TimeUnit.MILLISECONDS);
}
this.reportingStarted = true;
}
示例2: NbdStatsReporter
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
@Inject
public NbdStatsReporter(MetricRegistry metrics) {
ScheduledReporter reporter = Slf4jReporter.forRegistry(metrics)
.withLoggingLevel(Slf4jReporter.LoggingLevel.DEBUG)
.outputTo(LOGGER)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.build();
reporter.start(5, TimeUnit.SECONDS);
}
示例3: enableIgniteNodeOverloadStop
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
/**
* Will report to ignite that node is overloaded if the latency for requests from the given quantile will become
* larger than a given threshold.
*
* @param ignite Local ignite instance to be used for overload reporting.
* @param latencyThreshold Hard threshold after exceeding which node will report overload.
* @param quantile A quantile in {@code [0..1]}.
*/
public void enableIgniteNodeOverloadStop(Ignite ignite, long latencyThreshold, double quantile) {
ScheduledReporter reporter = IgniteNodeOverloadReporter.forRegistry(registry)
.setIgnite(ignite)
.setLatencyThreshold(latencyThreshold)
.setQuantile(quantile)
.build();
reporter.start(reportFrequency, TimeUnit.MILLISECONDS);
}
示例4: startReporters
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
public void startReporters() {
for (ReporterProvider provider : reporterProviders) {
ScheduledReporter reporter = provider.getIfEnabled();
if (reporter != null) {
reporters.add(reporter);
reporter.start(config.getReportFrequency(), TimeUnit.MILLISECONDS);
}
}
}
示例5: startMetrics
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
@Override
public void startMetrics() {
for (ScheduledReporter r : reporters) {
LOG.info("Starting metrics reporter {} reporting every {} Secs",
r.getClass().getCanonicalName(), metricsOutputFrequencyInSecs);
r.start(metricsOutputFrequencyInSecs, TimeUnit.SECONDS);
}
}
示例6: startScheduledReporter
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
/**
* {@link ScheduledReporter#start(long, java.util.concurrent.TimeUnit) Starts} the referenced {@link ScheduledReporter}
* @param id
* @param period
* @param unit
*/
public void startScheduledReporter(final String id, final int period, final TimeUnit unit) {
String key = StringUtils.lowerCase(StringUtils.trim(id));
ScheduledReporter scheduledReporter = this.scheduledReporters.get(key);
if(scheduledReporter != null) {
scheduledReporter.start(period, unit);
}
}
示例7: createReporter
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
public static ScheduledReporter createReporter(MetricsConfiguration configuration, MetricRegistry metrics) {
ScheduledReporter reporter = Slf4jReporter.forRegistry(metrics)
.outputTo(LoggerFactory.getLogger(configuration.getLoggerName()))
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.build();
reporter.start(configuration.getReportFrequencyInSeconds(), TimeUnit.SECONDS);
return reporter;
}
示例8: startInfluxdbReporterUDPV09
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
private static ScheduledReporter startInfluxdbReporterUDPV09(MetricRegistry registry) {
final ScheduledReporter reporter = InfluxdbReporter.forRegistry(registry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.protocol(new UdpInfluxdbProtocol("127.0.0.1", 8089))
.build();
reporter.start(20, TimeUnit.SECONDS);
return reporter;
}
示例9: startInfluxdbReporterHttpV09
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
private static ScheduledReporter startInfluxdbReporterHttpV09(MetricRegistry registry) {
final ScheduledReporter reporter = InfluxdbReporter.forRegistry(registry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.protocol(new HttpInfluxdbProtocol("127.0.0.1", 8086, "test", "u0", "u0PWD"))
.build();
reporter.start(10, TimeUnit.SECONDS);
return reporter;
}
示例10: enableDebugReporting
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
/**
* Enables statistics reporting to the console.
*/
public void enableDebugReporting() {
ScheduledReporter reporter = ConsoleReporter.forRegistry(registry)
.build();
reporter.start(reportFrequency, TimeUnit.MILLISECONDS);
}
示例11: enableCsvReporting
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
/**
* Enables statistics reporting to the csv file.
*
* @param csvReportDirectory Directory where .csv files for individual performance meters will be stored.
*/
public void enableCsvReporting(String csvReportDirectory) {
ScheduledReporter reporter = HumanReadableCsvReporter.forRegistry(registry)
.build(new File(csvReportDirectory));
reporter.start(reportFrequency, TimeUnit.MILLISECONDS);
}
示例12: start
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
@Synchronized
@Override
public void start() {
init();
if (conf.isEnableCSVReporter()) {
// NOTE: metrics output files are exclusive to a given process
File outdir;
if (!Strings.isNullOrEmpty(conf.getMetricsPrefix())) {
outdir = new File(conf.getCsvEndpoint(), conf.getMetricsPrefix());
} else {
outdir = new File(conf.getCsvEndpoint());
}
outdir.mkdirs();
log.info("Configuring stats with csv output to directory [{}]", outdir.getAbsolutePath());
reporters.add(CsvReporter.forRegistry(getMetrics())
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.build(outdir));
}
if (conf.isEnableStatsdReporter()) {
log.info("Configuring stats with statsD at {}:{}", conf.getStatsDHost(), conf.getStatsDPort());
reporters.add(StatsDReporter.forRegistry(getMetrics())
.build(conf.getStatsDHost(), conf.getStatsDPort()));
}
if (conf.isEnableGraphiteReporter()) {
log.info("Configuring stats with graphite at {}:{}", conf.getGraphiteHost(), conf.getGraphitePort());
final Graphite graphite = new Graphite(new InetSocketAddress(conf.getGraphiteHost(), conf.getGraphitePort()));
reporters.add(GraphiteReporter.forRegistry(getMetrics())
.prefixedWith(conf.getMetricsPrefix())
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.build(graphite));
}
if (conf.isEnableJMXReporter()) {
log.info("Configuring stats with jmx {}", conf.getJmxDomain());
final JmxReporter jmx = JmxReporter.forRegistry(getMetrics())
.inDomain(conf.getJmxDomain())
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.build();
jmx.start();
}
if (conf.isEnableGangliaReporter()) {
try {
log.info("Configuring stats with ganglia at {}:{}", conf.getGangliaHost(), conf.getGangliaPort());
final GMetric ganglia = new GMetric(conf.getGangliaHost(), conf.getGangliaPort(), GMetric.UDPAddressingMode.MULTICAST, 1);
reporters.add(GangliaReporter.forRegistry(getMetrics())
.prefixedWith(conf.getMetricsPrefix())
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.build(ganglia));
} catch (IOException e) {
log.warn("ganglia create failure: {}", e);
}
}
if (conf.isEnableConsoleReporter()) {
log.info("Configuring console reporter");
reporters.add(ConsoleReporter.forRegistry(getMetrics())
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.build());
}
for (ScheduledReporter r : reporters) {
r.start(conf.getStatsOutputFrequencySeconds(), TimeUnit.SECONDS);
}
}
示例13: startMetricReporting
import com.codahale.metrics.ScheduledReporter; //导入方法依赖的package包/类
/**
* Start all the {@link com.codahale.metrics.ScheduledReporter}s associated with this {@link MetricContext}.
*
* @param period the amount of time between polls
* @param timeUnit the unit for {@code period}
*/
public void startMetricReporting(long period, TimeUnit timeUnit) {
for (ScheduledReporter reporter : this.contextAwareScheduledReporters.values()) {
reporter.start(period, timeUnit);
}
}