當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。