本文整理汇总了Java中com.codahale.metrics.graphite.GraphiteReporter.start方法的典型用法代码示例。如果您正苦于以下问题:Java GraphiteReporter.start方法的具体用法?Java GraphiteReporter.start怎么用?Java GraphiteReporter.start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.codahale.metrics.graphite.GraphiteReporter
的用法示例。
在下文中一共展示了GraphiteReporter.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: config
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
public static void config(String graphiteHost, int port, TimeUnit tu,
int period, VertxOptions vopt, String hostName) {
final String registryName = "okapi";
MetricRegistry registry = SharedMetricRegistries.getOrCreate(registryName);
DropwizardMetricsOptions metricsOpt = new DropwizardMetricsOptions();
metricsOpt.setEnabled(true).setRegistryName(registryName);
vopt.setMetricsOptions(metricsOpt);
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, port));
final String prefix = "folio.okapi." + hostName ;
GraphiteReporter reporter = GraphiteReporter.forRegistry(registry)
.prefixedWith(prefix)
.build(graphite);
reporter.start(period, tu);
logger.info("Metrics remote:" + graphiteHost + ":"
+ port + " this:" + prefix);
}
示例2: init
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@PostConstruct
private void init() {
if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost();
Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort();
String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix();
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
示例3: report
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@Override
public void report(MetricRegistry metricRegistry) {
JbootMetricsGraphiteReporterConfig config = Jboot.config(JbootMetricsGraphiteReporterConfig.class);
if (StringUtils.isBlank(config.getHost())) {
throw new NullPointerException("graphite reporter host must not be null, please config jboot.metrics.reporter.graphite.host in you properties.");
}
if (config.getPort() == null) {
throw new NullPointerException("graphite reporter port must not be null, please config jboot.metrics.reporter.graphite.port in you properties.");
}
if (config.getPrefixedWith() == null) {
throw new NullPointerException("graphite reporter prefixedWith must not be null, please config jboot.metrics.reporter.graphite.prefixedWith in you properties.");
}
Graphite graphite = new Graphite(new InetSocketAddress(config.getHost(), config.getPort()));
GraphiteReporter reporter = GraphiteReporter.forRegistry(metricRegistry)
.prefixedWith(config.getPrefixedWith())
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.build(graphite);
reporter.start(1, TimeUnit.MINUTES);
}
示例4: init
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@PostConstruct
private void init() {
if (properties.getMetrics().getGraphite().isEnabled()) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = properties.getMetrics().getGraphite().getHost();
Integer graphitePort = properties.getMetrics().getGraphite().getPort();
String graphitePrefix = properties.getMetrics().getGraphite().getPrefix();
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
示例5: init
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@PostConstruct
private void init() {
Boolean graphiteEnabled = propertyResolver.getProperty(PROP_GRAPHITE_ENABLED, Boolean.class, false);
if (graphiteEnabled) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = propertyResolver.getRequiredProperty(PROP_HOST);
Integer graphitePort = propertyResolver.getRequiredProperty(PROP_PORT, Integer.class);
String graphitePrefix = propertyResolver.getProperty(PROP_GRAPHITE_PREFIX, String.class, "");
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
示例6: GraphiteRegistry
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
public GraphiteRegistry(MetricRegistry metricRegistry, JHipsterProperties jHipsterProperties) {
this.jHipsterProperties = jHipsterProperties;
if (this.jHipsterProperties.getMetrics().getGraphite().isEnabled()) {
log.info(INITIALIZING_MESSAGE);
String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost();
Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort();
String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix();
Graphite graphite = getGraphite(graphiteHost, graphitePort);
GraphiteReporter graphiteReporter = getBuilder(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(REPORTER_PERIOD, TimeUnit.MINUTES);
}
}
示例7: init
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
private static void init() {
// Init JMX reporter
reporter = JmxReporter.forRegistry(registry).build();
reporter.start();
// Init graphite reporter
Graphite graphite = getGraphite();
GraphiteReporter graphiteReporter;
if (graphite == null) {
graphiteReporter = null;
} else {
graphiteReporter =
GraphiteReporter.forRegistry(registry).prefixedWith(PREFIX).convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS).filter(MetricFilter.ALL).build(graphite);
graphiteReporter.start(AuditConfig.GRAPHITE_REPORT_PERIOD_SEC, TimeUnit.SECONDS);
}
}
示例8: run
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@Override
public void run(ExampleConfiguration configuration, Environment environment) throws Exception {
if(configuration.metricsEnabled()) {
final Graphite graphite = new Graphite(new InetSocketAddress("graphite.example.com", 2003));
final GraphiteReporter reporter = GraphiteReporter.forRegistry(environment.metrics())
.prefixedWith("prefix")
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.build(graphite);
reporter.start(5, TimeUnit.SECONDS);
final ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(environment.metrics()).build();
consoleReporter.start(5, TimeUnit.SECONDS);
}
final ExampleResource exampleResource = new ExampleResource(environment.metrics());
environment.jersey().register(exampleResource);
}
示例9: init
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@PostConstruct
private void init() {
if (applicationProperties.getMetrics().getGraphite().isEnabled()) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = applicationProperties.getMetrics().getGraphite().getHost();
Integer graphitePort = applicationProperties.getMetrics().getGraphite().getPort();
String graphitePrefix = applicationProperties.getMetrics().getGraphite().getPrefix();
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
示例10: init
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@PostConstruct
private void init() {
if (jHipsterProperties.getMetrics().getGraphite().isEnabled()) {
log.info("Initializing Metrics Graphite reporting");
String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost();
Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort();
String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix();
Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort));
GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry)
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.prefixedWith(graphitePrefix)
.build(graphite);
graphiteReporter.start(1, TimeUnit.MINUTES);
}
}
示例11: start
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的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);
}
示例12: init
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@PostConstruct()
public void init() {
registerBaseMetrics();
registerReporter(jmxReporterBuilder().build()).start();
if (graphiteConfiguration.isEnabled()) {
GraphiteReporter graphiteReporter = graphiteReporterBuilder().build(newGraphite());
registerReporter(graphiteReporter);
graphiteReporter.start(graphiteConfiguration.getPollInterval(), graphiteConfiguration.getPollIntervalTimeUnit());
}
}
示例13: shouldBeAbleToCreateAGraphiteReporter
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@Test
public void shouldBeAbleToCreateAGraphiteReporter() throws Exception {
final Graphite graphite = new Graphite(new InetSocketAddress("graphite.example.com", 2003));
final MetricRegistry registry = new MetricRegistry();
final GraphiteReporter reporter = GraphiteReporter
.forRegistry(registry)
.prefixedWith("web1.example.com")
.convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS)
.filter(MetricFilter.ALL)
.build(graphite);
reporter.start(1, TimeUnit.MINUTES);
}
开发者ID:alphagov,项目名称:verify-matching-service-adapter,代码行数:14,代码来源:GraphiteReporterIntegrationTest.java
示例14: startGraphite
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
@PostConstruct
protected void startGraphite() {
// Graphite Reporting to Graphite Server using Dropwizard Metrics
final Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, 2003));
final GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metrics).prefixedWith("demo.arity.com").convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).filter(MetricFilter.ALL).build(graphite);
graphiteReporter.start(10, TimeUnit.SECONDS);
}
示例15: graphiteReporter
import com.codahale.metrics.graphite.GraphiteReporter; //导入方法依赖的package包/类
/**
* Create reporter bean and tell Spring to call stop() when shutting down.
* UPD must be enabled in carbon.conf
*
* @return graphite reporter
*/
@Bean(destroyMethod = "stop")
public GraphiteReporter graphiteReporter() {
final GraphiteSender graphite = new GraphiteUDP(new InetSocketAddress("localhost", 2003));
final GraphiteReporter reporter = GraphiteReporter.forRegistry(metricRegistry).prefixedWith("camel-spring-boot").convertRatesTo(TimeUnit.SECONDS)
.convertDurationsTo(TimeUnit.MILLISECONDS).filter(MetricFilter.ALL).build(graphite);
reporter.start(5, TimeUnit.SECONDS);
return reporter;
}