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


Java Slf4jReporter.start方法代码示例

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


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

示例1: init

import com.codahale.metrics.Slf4jReporter; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    log.debug("Registering JVM gauges");
    metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
    metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
    if (jHipsterProperties.getMetrics().getJmx().isEnabled()) {
        log.debug("Initializing Metrics JMX reporting");
        JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();
        jmxReporter.start();
    }
    if (jHipsterProperties.getMetrics().getLogs().isEnabled()) {
        log.info("Initializing Metrics Log reporting");
        final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry)
            .outputTo(LoggerFactory.getLogger("metrics"))
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
        reporter.start(jHipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS);
    }
}
 
开发者ID:oktadeveloper,项目名称:jhipster-microservices-example,代码行数:24,代码来源:MetricsConfiguration.java

示例2: init

import com.codahale.metrics.Slf4jReporter; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    log.debug("Registering JVM gauges");
    metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
    metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
    if (jHipsterProperties.getMetrics().getJmx().isEnabled()) {
        log.debug("Initializing Metrics JMX reporting");
        JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();
        jmxReporter.start();
    }

    if (jHipsterProperties.getMetrics().getLogs().isEnabled()) {
        log.info("Initializing Metrics Log reporting");
        final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry)
            .outputTo(LoggerFactory.getLogger("metrics"))
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
        reporter.start(jHipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS);
    }
}
 
开发者ID:quanticc,项目名称:sentry,代码行数:25,代码来源:MetricsConfiguration.java

示例3: run

import com.codahale.metrics.Slf4jReporter; //导入方法依赖的package包/类
@Override
public void run(DemoConfiguration config, Environment env) throws Exception {
  DemoProducer producer = new DemoProducer(config.getKafkaConfig(), env.metrics());
  DemoConsumer consumer = new DemoConsumer(config.getKafkaConfig(), env.metrics());

  env.lifecycle().manage(producer);
  env.lifecycle().manage(consumer);

  env.jersey().register(DeclarativeLinkingFeature.class);
  env.jersey().register(new DemoResource(producer, consumer));

  final Slf4jReporter reporter = Slf4jReporter.forRegistry(env.metrics())
          .outputTo(LOG)
          .convertRatesTo(TimeUnit.SECONDS)
          .convertDurationsTo(TimeUnit.MILLISECONDS)
          .build();

  reporter.start(1, TimeUnit.MINUTES);
}
 
开发者ID:herokumx,项目名称:kafka-rest,代码行数:20,代码来源:DemoApplication.java

示例4: init

import com.codahale.metrics.Slf4jReporter; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    log.debug("Registering JVM gauges");
    metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
    metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
    metricRegistry.register(PROP_METRIC_REG_JVM_ATTRIBUTE_SET, new JvmAttributeGaugeSet());
    if (jHipsterProperties.getMetrics().getJmx().isEnabled()) {
        log.debug("Initializing Metrics JMX reporting");
        JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();
        jmxReporter.start();
    }
    if (jHipsterProperties.getMetrics().getLogs().isEnabled()) {
        log.info("Initializing Metrics Log reporting");
        Marker metricsMarker = MarkerFactory.getMarker("metrics");
        final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry)
            .outputTo(LoggerFactory.getLogger("metrics"))
            .markWith(metricsMarker)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
        reporter.start(jHipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS);
    }
}
 
开发者ID:kalnee,项目名称:trivor,代码行数:27,代码来源:MetricsConfiguration.java

示例5: configureReporters

import com.codahale.metrics.Slf4jReporter; //导入方法依赖的package包/类
@Override
public void configureReporters(MetricRegistry metricRegistry) {
    final LoggerContext factory = (LoggerContext) LoggerFactory.getILoggerFactory();
    final Logger root = factory.getLogger(Logger.ROOT_LOGGER_NAME);

    final InstrumentedAppender metrics = new InstrumentedAppender(metricRegistry);
    metrics.setContext(root.getLoggerContext());
    metrics.start();
    root.addAppender(metrics);
    JmxReporter.forRegistry(metricRegistry).build().start();
    Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry)
            .outputTo(LoggerFactory.getLogger("metrics"))
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
            reporter.start(1, TimeUnit.MINUTES);
}
 
开发者ID:przodownikR1,项目名称:springJpaKata,代码行数:18,代码来源:MetricsConfig.java

示例6: init

import com.codahale.metrics.Slf4jReporter; //导入方法依赖的package包/类
@PostConstruct
public void init() {
	log.debug("Registering JVM gauges");
	metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
	metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet());
	metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet());
	metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
	metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
	if (jHipsterProperties.getMetrics().getJmx().isEnabled()) {
		log.debug("Initializing Metrics JMX reporting");
		JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();
		jmxReporter.start();
	}
	if (jHipsterProperties.getMetrics().getLogs().isEnabled()) {
		log.info("Initializing Metrics Log reporting");
		final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry)
			.outputTo(LoggerFactory.getLogger("metrics"))
			.convertRatesTo(TimeUnit.SECONDS)
			.convertDurationsTo(TimeUnit.MILLISECONDS)
			.build();
		reporter.start(jHipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS);
	}
}
 
开发者ID:alikemalocalan,项目名称:MicroBlog,代码行数:24,代码来源:MetricsConfiguration.java

示例7: initialize

import com.codahale.metrics.Slf4jReporter; //导入方法依赖的package包/类
public static void initialize(MetricRegistry registry) {
if (Metrics.registry != null) {
    throw new IllegalStateException("Metrics were already initialized.");
}
Metrics.registry = registry;
registry.register("memory_usage", new MemoryUsageGaugeSet());
registry.register("garbage_collector", new GarbageCollectorMetricSet());
registry.register("jvm_attributes", new JvmAttributeGaugeSet());

final JmxReporter jmxReporter = JmxReporter.forRegistry(registry).build();
jmxReporter.start();

final Slf4jReporter slf4jReporter = Slf4jReporter.forRegistry(registry)
	.outputTo(LoggerFactory.getLogger("com.puresoltechnologies.famility.server.metrics"))
	.convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).build();
slf4jReporter.start(1, TimeUnit.MINUTES);
   }
 
开发者ID:PureSolTechnologies,项目名称:DuctileDB,代码行数:18,代码来源:Metrics.java

示例8: main

import com.codahale.metrics.Slf4jReporter; //导入方法依赖的package包/类
public static void main(String[] args)
{
    PipelineContext context = new PipelineContext(new BasicPacketFactory());

    DirectPipeline pipeline = new DirectPipeline(context);

    pipeline
        .addSource(new RandomIntGenerator(0, 10))
        .setReceiver(new FilterTransformation<>(new MinMaxFilter<>(3, 7)))
        .setReceiver(new PrintSink());

    pipeline
        .addSource(new StdInSource())
        .setReceiver(new FilterTransformation<>(new StringContainsFilter("foo")))
        .setReceiver(new UpperCaseTransformation())
        .setReceiver(new PrintSink());

    pipeline.start();

    final Slf4jReporter reporter = Slf4jReporter.forRegistry(context.getMetrics())
        .outputTo(LoggerFactory.getLogger("io.humbird.metrics"))
        .convertRatesTo(TimeUnit.SECONDS)
        .convertDurationsTo(TimeUnit.MILLISECONDS)
        .build();
    reporter.start(5, TimeUnit.SECONDS);
}
 
开发者ID:bandesz,项目名称:humbird.io,代码行数:27,代码来源:DirectPipelineDemo.java

示例9: start

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

示例10: init

import com.codahale.metrics.Slf4jReporter; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    log.debug("Registering JVM gauges");
    metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
    metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
    if (hikariDataSource != null) {
        log.debug("Monitoring the datasource");
        hikariDataSource.setMetricRegistry(metricRegistry);
    }
    if (jHipsterProperties.getMetrics().getJmx().isEnabled()) {
        log.debug("Initializing Metrics JMX reporting");
        JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();
        jmxReporter.start();
    }
    if (jHipsterProperties.getMetrics().getLogs().isEnabled()) {
        log.info("Initializing Metrics Log reporting");
        final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry)
            .outputTo(LoggerFactory.getLogger("metrics"))
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
        reporter.start(jHipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS);
    }
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:28,代码来源:MetricsConfiguration.java

示例11: init

import com.codahale.metrics.Slf4jReporter; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    log.debug("Registering JVM gauges");
    metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
    metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));

    metricRegistry.register(PROP_METRIC_REG_JCACHE_STATISTICS, new JCacheGaugeSet());
    if (hikariDataSource != null) {
        log.debug("Monitoring the datasource");
        hikariDataSource.setMetricRegistry(metricRegistry);
    }
    if (jHipsterProperties.getMetrics().getJmx().isEnabled()) {
        log.debug("Initializing Metrics JMX reporting");
        JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();
        jmxReporter.start();
    }
    if (jHipsterProperties.getMetrics().getLogs().isEnabled()) {
        log.info("Initializing Metrics Log reporting");
        final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry)
            .outputTo(LoggerFactory.getLogger("metrics"))
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
        reporter.start(jHipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS);
    }
}
 
开发者ID:Microsoft,项目名称:MTC_Labrat,代码行数:30,代码来源:MetricsConfiguration.java

示例12: init

import com.codahale.metrics.Slf4jReporter; //导入方法依赖的package包/类
@PostConstruct
public void init() {
    log.debug("Registering JVM gauges");
    metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet());
    metricRegistry.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
    metricRegistry.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
    metricRegistry.register(PROP_METRIC_REG_JVM_ATTRIBUTE_SET, new JvmAttributeGaugeSet());
    metricRegistry.register(PROP_METRIC_REG_JCACHE_STATISTICS, new JCacheGaugeSet());
    if (hikariDataSource != null) {
        log.debug("Monitoring the datasource");
        hikariDataSource.setMetricRegistry(metricRegistry);
    }
    if (jHipsterProperties.getMetrics().getJmx().isEnabled()) {
        log.debug("Initializing Metrics JMX reporting");
        JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();
        jmxReporter.start();
    }
    if (jHipsterProperties.getMetrics().getLogs().isEnabled()) {
        log.info("Initializing Metrics Log reporting");
        Marker metricsMarker = MarkerFactory.getMarker("metrics");
        final Slf4jReporter reporter = Slf4jReporter.forRegistry(metricRegistry)
            .outputTo(LoggerFactory.getLogger("metrics"))
            .markWith(metricsMarker)
            .convertRatesTo(TimeUnit.SECONDS)
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .build();
        reporter.start(jHipsterProperties.getMetrics().getLogs().getReportFrequency(), TimeUnit.SECONDS);
    }
}
 
开发者ID:asanzdiego,项目名称:codemotion-2017-taller-de-jhipster,代码行数:32,代码来源:MetricsConfiguration.java

示例13: report

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

示例14: getLogReporter

import com.codahale.metrics.Slf4jReporter; //导入方法依赖的package包/类
private static Slf4jReporter getLogReporter() {
  if (config.getBoolean(ExecConstants.METRICS_LOG_OUTPUT_ENABLED)) {
    Slf4jReporter reporter = Slf4jReporter.forRegistry(getInstance()).outputTo(logger)
        .convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).build();
    reporter.start(config.getInt(ExecConstants.METRICS_LOG_OUTPUT_INTERVAL), TimeUnit.SECONDS);

    return reporter;
  } else {
    return null;
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:12,代码来源:DrillMetrics.java

示例15: getLogReporter

import com.codahale.metrics.Slf4jReporter; //导入方法依赖的package包/类
private static Slf4jReporter getLogReporter() {
  if (config.getBoolean(METRICS_LOG_OUTPUT_ENABLED)) {
    Slf4jReporter reporter = Slf4jReporter.forRegistry(getInstance()).outputTo(logger)
        .convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).build();
    reporter.start(config.getInt(METRICS_LOG_OUTPUT_INTERVAL), TimeUnit.SECONDS);

    return reporter;
  } else {
    return null;
  }
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:12,代码来源:Metrics.java


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