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


Java JmxReporter.start方法代码示例

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


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

示例1: init

import com.codahale.metrics.JmxReporter; //导入方法依赖的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.JmxReporter; //导入方法依赖的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

示例3: init

import com.codahale.metrics.JmxReporter; //导入方法依赖的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:dlwhitehurst,项目名称:blackhole,代码行数:25,代码来源:MetricsConfiguration.java

示例4: init

import com.codahale.metrics.JmxReporter; //导入方法依赖的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: getAPIResourceConfig

import com.codahale.metrics.JmxReporter; //导入方法依赖的package包/类
@Named("APIResourceConfig")
@Singleton
@Provides
public ResourceConfig getAPIResourceConfig(StateMachineResource stateMachineResource, DeploymentUnitResource deploymentUnitResource,
										   StatusResource statusResource, MetricRegistry metricRegistry) {
	ResourceConfig resourceConfig = new ResourceConfig();

	//Register codahale metrics and publish to jmx
	resourceConfig.register(new InstrumentedResourceMethodApplicationListener(metricRegistry));
	JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();

	//register resources
	resourceConfig.register(stateMachineResource);
	resourceConfig.register(deploymentUnitResource);
	resourceConfig.register(statusResource);

	resourceConfig.register(CORSFilter.class);
	jmxReporter.start();
	return resourceConfig;
}
 
开发者ID:flipkart-incubator,项目名称:flux,代码行数:21,代码来源:ContainerModule.java

示例6: activateService

import com.codahale.metrics.JmxReporter; //导入方法依赖的package包/类
@Override
public void activateService() {
    metricRegistry = new MetricRegistry();
    healthCheckRegistry = new HealthCheckRegistry();
    CodahaleMetricsDeclaration declaration = descriptor.metaInfo( CodahaleMetricsDeclaration.class );
    prefix = declaration.prefix() != null ? declaration.prefix() : app.name();
    fqcn = declaration.fqcn();
    if( declaration.jmx() )
    {
        JmxReporter jmxReporter = JmxReporter.forRegistry( metricRegistry ).build();
        jmxReporter.start();
        reporters.add( jmxReporter );
    }
    for( Function<MetricRegistry, Reporter> reporterFactory : declaration.reportersFactories())
    {
        reporters.add( reporterFactory.apply( metricRegistry ) );
    }
}
 
开发者ID:apache,项目名称:polygene-java,代码行数:19,代码来源:CodahaleMetricsMixin.java

示例7: initialize

import com.codahale.metrics.JmxReporter; //导入方法依赖的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.JmxReporter; //导入方法依赖的package包/类
public static void main(String[] args) {
	SpringApplication.run(MonetaSpringBootApplication.class, args);

	// Find and read application configuration
	MonetaConfiguration config = new MonetaConfiguration();

	// Install all health checks
	HealthCheckRegistry registry = new HealthCheckRegistry();
	for (String checkName : MonetaEnvironment.getConfiguration()
			.getHealthChecks()
			.keySet()) {
		registry.register(checkName, MonetaEnvironment.getConfiguration()
				.getHealthChecks()
				.get(checkName));
	}
	ActuatorHealthIndicator.setHealthCheckRegistry(registry);

	// Install metrics and JMX
	MetricRegistry metricRegistry = new MetricRegistry();
	final JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry)
			.build();
	jmxReporter.start();
}
 
开发者ID:Derek-Ashmore,项目名称:moneta,代码行数:24,代码来源:MonetaSpringBootApplication.java

示例9: registerJmxReporter

import com.codahale.metrics.JmxReporter; //导入方法依赖的package包/类
private void registerJmxReporter(@NonNull final RunRightFastVerticleDeployment deployment) {
    if (verticleJmxReporters.containsKey(deployment)) {
        return;
    }

    if (globalDeployedVerticles.values().contains(deployment)) {
        return;
    }

    final RunRightFastVerticleId verticleId = deployment.getRunRightFastVerticleId();
    final JmxReporter jmxReporter = JmxReporter.forRegistry(deployment.getMetricRegistry())
            .inDomain(verticleId.verticleJmxDomain("metrics"))
            .convertDurationsTo(TimeUnit.MILLISECONDS)
            .convertRatesTo(TimeUnit.SECONDS)
            .build();
    jmxReporter.start();
    verticleJmxReporters = ImmutableMap.<RunRightFastVerticleDeployment, JmxReporter>builder()
            .putAll(verticleJmxReporters)
            .put(deployment, jmxReporter)
            .build();
}
 
开发者ID:runrightfast,项目名称:runrightfast-vertx,代码行数:22,代码来源:RunRightFastVerticleManager.java

示例10: initReporting

import com.codahale.metrics.JmxReporter; //导入方法依赖的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

示例11: start

import com.codahale.metrics.JmxReporter; //导入方法依赖的package包/类
@Override
public List<AutoCloseable> start(Params params) {
  SimpleConfiguration config =
      new FluoConfiguration(params.getConfiguration()).getReporterConfiguration("jmx");

  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());

  JmxReporter reporter =
      JmxReporter.forRegistry(params.getMetricRegistry()).convertDurationsTo(durationUnit)
          .convertRatesTo(rateUnit).inDomain(params.getDomain()).build();
  reporter.start();

  log.info("Reporting metrics to JMX");

  return Collections.singletonList((AutoCloseable) reporter);
}
 
开发者ID:apache,项目名称:fluo,代码行数:23,代码来源:JmxReporterStarter.java

示例12: main

import com.codahale.metrics.JmxReporter; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception {
  VerifiableProperties verifiableProperties = ToolUtils.getVerifiableProperties(args);
  MetricRegistry registry = new MetricRegistry();
  StoreToolsMetrics metrics = new StoreToolsMetrics(registry);
  JmxReporter reporter = null;
  try {
    reporter = JmxReporter.forRegistry(registry).build();
    reporter.start();
    DumpDataTool dumpDataTool = new DumpDataTool(verifiableProperties, metrics);
    dumpDataTool.doOperation();
  } finally {
    if (reporter != null) {
      reporter.stop();
    }
  }
}
 
开发者ID:linkedin,项目名称:ambry,代码行数:17,代码来源:DumpDataTool.java

示例13: main

import com.codahale.metrics.JmxReporter; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception {
  VerifiableProperties verifiableProperties = ToolUtils.getVerifiableProperties(args);
  MetricRegistry registry = new MetricRegistry();
  StoreToolsMetrics metrics = new StoreToolsMetrics(registry);
  JmxReporter reporter = null;
  try {
    reporter = JmxReporter.forRegistry(registry).build();
    reporter.start();
    DumpLogTool dumpLogTool = new DumpLogTool(verifiableProperties, metrics);
    dumpLogTool.doOperation();
  } finally {
    if (reporter != null) {
      reporter.stop();
    }
  }
}
 
开发者ID:linkedin,项目名称:ambry,代码行数:17,代码来源:DumpLogTool.java

示例14: init

import com.codahale.metrics.JmxReporter; //导入方法依赖的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

示例15: init

import com.codahale.metrics.JmxReporter; //导入方法依赖的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


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