当前位置: 首页>>代码示例>>Java>>正文


Java ConsoleReporter.start方法代码示例

本文整理汇总了Java中com.codahale.metrics.ConsoleReporter.start方法的典型用法代码示例。如果您正苦于以下问题:Java ConsoleReporter.start方法的具体用法?Java ConsoleReporter.start怎么用?Java ConsoleReporter.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.codahale.metrics.ConsoleReporter的用法示例。


在下文中一共展示了ConsoleReporter.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addTimerForPdxTypeMetrics

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void addTimerForPdxTypeMetrics(final ClientCache clientCache) {

        Region temp = clientCache.getRegion("PdxTypes");
        if (temp == null) {
            temp = clientCache.createClientRegionFactory(ClientRegionShortcut.PROXY).create("PdxTypes");
        }
        final Region pdxRegions = temp;

        metricRegistry.register(MetricRegistry.name("PdxTypes", "count"),
                (Gauge<Integer>) () -> pdxRegions.keySetOnServer().size());

        ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry)
                .convertRatesTo(TimeUnit.SECONDS)
                .convertDurationsTo(TimeUnit.MILLISECONDS)
                .build();
        reporter.start(1, TimeUnit.MINUTES);
    }
 
开发者ID:charliemblack,项目名称:gemfire-copy,代码行数:18,代码来源:ToolBox.java

示例2: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
    MemoryConsumer consumer = new MemoryConsumer();
    GcMonitor gcMonitor = GcMonitor.builder()
            .addRollingWindow("15min", Duration.ofMinutes(15))
            .build();
    gcMonitor.start();

    MetricRegistry registry = new MetricRegistry();
    registry.registerAll(DropwizardAdapter.toMetricSet("jvm-gc-monitor", gcMonitor));
    ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(registry).build();
    consoleReporter.start(10, TimeUnit.SECONDS);

    try {
        while (true) {
            consumer.consume(ThreadLocalRandom.current().nextInt(10) + 1,  1);
            consumer.consume(ThreadLocalRandom.current().nextInt(20) + 100,  1);
            TimeUnit.SECONDS.sleep(5);
        }
    } finally {
        consumer.close();
        gcMonitor.stop();
    }
}
 
开发者ID:vladimir-bukhtoyarov,项目名称:gc-monitor,代码行数:24,代码来源:DropwizardMain.java

示例3: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String args[]) throws IOException, InterruptedException {
	ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics).convertRatesTo(TimeUnit.SECONDS)
			.convertDurationsTo(TimeUnit.MILLISECONDS).build();
	metrics.register("jvm.mem", new MemoryUsageGaugeSet());
	metrics.register("jvm.gc", new GarbageCollectorMetricSet());
	reporter.start(5, TimeUnit.SECONDS);

	String hostName = "192.168.66.29";
	ZabbixSender zabbixSender = new ZabbixSender("192.168.90.102", 10051);
	ZabbixReporter zabbixReporter = ZabbixReporter.forRegistry(metrics).hostName(hostName).prefix("test.")
			.build(zabbixSender);

	zabbixReporter.start(1, TimeUnit.SECONDS);

	TimeUnit.SECONDS.sleep(500);
}
 
开发者ID:hengyunabc,项目名称:metrics-zabbix,代码行数:17,代码来源:GetStarted.java

示例4: run

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的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);
}
 
开发者ID:pims,项目名称:dropwizard-metrics-example,代码行数:24,代码来源:ExampleApplication.java

示例5: testRegister

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
@Test
@Ignore("ad-hoc")
public void testRegister() throws Exception {
    // reporterAgent.allowedBeans= new ImmutableMap.Builder<String, String>().put("java.lang:type=Memory.HeapMemoryUsage","sssswww").build();
    String file = this.getClass().getResource("/test2.json").getFile();

    reporterAgent.readConfig(file);
    reporterAgent.initLogger();
    reporterAgent.registerPlatformBeans();

    reporterAgent.addBeanNotificationListener();
    ConsoleReporter reporter= ConsoleReporter.forRegistry(reporterAgent.metricRegistry)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
    reporter.start(1, TimeUnit.SECONDS);
    while(true) {
        // eat some memory
        String s = "";
        for (int i = 0; i < 100000; i++) {
             s+="asdasdasd";
        }
    }
}
 
开发者ID:mojn,项目名称:jmx-cloudwatch-reporter,代码行数:25,代码来源:ReporterAgentTest.java

示例6: initReporting

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public synchronized void initReporting(Reporting reporting) {
  if(!reportingInitialized) {
    switch(reporting) {
      case CONSOLE:
        final ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(SentryMetricsServletContextListener.METRIC_REGISTRY)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
        consoleReporter.start(1, TimeUnit.SECONDS);
        break;
      case JMX:
        final JmxReporter jmxReporter = JmxReporter.forRegistry(SentryMetricsServletContextListener.METRIC_REGISTRY)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
        jmxReporter.start();
        break;
    }
  }
}
 
开发者ID:apache,项目名称:incubator-sentry,代码行数:21,代码来源:SentryMetrics.java

示例7: start

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的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);
}
 
开发者ID:apache,项目名称:fluo,代码行数:26,代码来源:ConsoleReporterStarter.java

示例8: startReport

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
protected void startReport() {
    ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
    reporter.start(1, TimeUnit.SECONDS);
}
 
开发者ID:TFdream,项目名称:metrics-tutorials,代码行数:8,代码来源:AbstractMetricsDemo.java

示例9: report

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
@Override
public void report(MetricRegistry metricRegistry) {
    final ConsoleReporter reporter = ConsoleReporter.forRegistry(metricRegistry)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
    reporter.start(1, TimeUnit.MINUTES);
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:9,代码来源:JbootConsoleReporter.java

示例10: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException, InterruptedException {
	
	ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics).convertRatesTo(TimeUnit.SECONDS)
			.convertDurationsTo(TimeUnit.MILLISECONDS).build();
	
	metrics.register("jvm.mem", new MemoryUsageGaugeSet());
	metrics.register("jvm.gc", new GarbageCollectorMetricSet() );
	metrics.register("jvm.threads", new ThreadStatesGaugeSet() );
	reporter.start(30, TimeUnit.SECONDS);

	TimeUnit.SECONDS.sleep(500);
}
 
开发者ID:variflight,项目名称:feeyo-redisproxy,代码行数:13,代码来源:MetricTest.java

示例11: setUp

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
@Before
public void setUp() {
    ConsoleReporter reporter = ConsoleReporter.forRegistry(METRIC_REGISTRY)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
    reporter.start(1, TimeUnit.SECONDS);
}
 
开发者ID:geekflow,项目名称:light,代码行数:9,代码来源:MetricRegistryTest.java

示例12: startReport

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
static void startReport() {
    ConsoleReporter reporter = ConsoleReporter.forRegistry(metrics)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
    reporter.start(1, TimeUnit.SECONDS);
}
 
开发者ID:bingoohuang,项目名称:javacode-demo,代码行数:8,代码来源:MetricsGetStarted.java

示例13: consoleMetricReporter

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
@Bean
@ConditionalOnProperty(prefix = "hono.metric.reporter.console", name = "active", havingValue = "true")
public ConsoleReporter consoleMetricReporter(
        @Value("${hono.metric.reporter.console.period:5000}") final Long period) {
    LOG.info("metrics - console reporter activated");
    final ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(metricRegistry)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .filter(MetricFilter.ALL)
            .build();
    consoleReporter.start(period, TimeUnit.MILLISECONDS);
    return consoleReporter;
}
 
开发者ID:eclipse,项目名称:hono,代码行数:14,代码来源:MetricConfig.java

示例14: consoleReporter

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public ConsoleReporter consoleReporter( MetricRegistry registry ) {
    ConsoleReporter reporter = ConsoleReporter.forRegistry(registry)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
    reporter.start(10, TimeUnit.SECONDS);
    return reporter;
}
 
开发者ID:Abiy,项目名称:distGatling,代码行数:9,代码来源:MonitoringConfiguration.java

示例15: main

import com.codahale.metrics.ConsoleReporter; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  final MetricRegistry metrics = new MetricRegistry();

  final HadoopMetrics2Reporter metrics2Reporter = HadoopMetrics2Reporter.forRegistry(metrics)
      .build(DefaultMetricsSystem.initialize("StandaloneTest"), // The application-level name
             "Test", // Component name
             "Test", // Component description
             "Test"); // Name for each metric record
  final ConsoleReporter consoleReporter = ConsoleReporter.forRegistry(metrics).build();

  MetricsSystem metrics2 = DefaultMetricsSystem.instance();
  // Writes to stdout without a filename configuration
  // Will be invoked every 10seconds by default
  FileSink sink = new FileSink();
  metrics2.register("filesink", "filesink", sink);
  sink.init(new SubsetConfiguration(null, null) {
    public String getString(String key) {
      if (key.equals("filename")) {
        return null;
      }
      return super.getString(key);
    }
  });

  // How often should the dropwizard reporter be invoked
  metrics2Reporter.start(500, TimeUnit.MILLISECONDS);
  // How often will the dropwziard metrics be logged to the console
  consoleReporter.start(2, TimeUnit.SECONDS);

  generateMetrics(metrics, 5000, 25, TimeUnit.MILLISECONDS, metrics2Reporter, 10);
}
 
开发者ID:joshelser,项目名称:dropwizard-hadoop-metrics2,代码行数:32,代码来源:StandaloneExample.java


注:本文中的com.codahale.metrics.ConsoleReporter.start方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。