本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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 ) );
}
}
示例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);
}
示例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();
}
示例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();
}
示例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;
}
}
}
示例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);
}
示例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();
}
}
}
示例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();
}
}
}
示例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);
}
}
示例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);
}
}