本文整理汇总了Java中com.codahale.metrics.JvmAttributeGaugeSet类的典型用法代码示例。如果您正苦于以下问题:Java JvmAttributeGaugeSet类的具体用法?Java JvmAttributeGaugeSet怎么用?Java JvmAttributeGaugeSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JvmAttributeGaugeSet类属于com.codahale.metrics包,在下文中一共展示了JvmAttributeGaugeSet类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMetricsHandler
import com.codahale.metrics.JvmAttributeGaugeSet; //导入依赖的package包/类
private ServletContextHandler getMetricsHandler() {
MetricRegistry registry = Metrics.getRegistry();
HealthCheckRegistry healthCheckRegistry = Metrics.getHealthCheckRegistry();
healthCheckRegistry.register("rotation", new Rotation(configuration.getRotationStatusFilePath()));
registry.registerAll(new GarbageCollectorMetricSet());
registry.registerAll(new MemoryUsageGaugeSet());
registry.registerAll(new ThreadStatesGaugeSet());
registry.registerAll(new JvmAttributeGaugeSet());
ServletContextHandler servletContextHandler = new ServletContextHandler();
servletContextHandler.setContextPath("/__metrics");
servletContextHandler.setAttribute(MetricsServlet.class.getCanonicalName() + ".registry", registry);
servletContextHandler.setAttribute(HealthCheckServlet.class.getCanonicalName() + ".registry", healthCheckRegistry);
servletContextHandler.addServlet(new ServletHolder(new AdminServlet()), "/*");
return servletContextHandler;
}
示例2: init
import com.codahale.metrics.JvmAttributeGaugeSet; //导入依赖的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);
}
}
示例3: initialize
import com.codahale.metrics.JvmAttributeGaugeSet; //导入依赖的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);
}
示例4: init
import com.codahale.metrics.JvmAttributeGaugeSet; //导入依赖的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 (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);
}
}
示例5: init
import com.codahale.metrics.JvmAttributeGaugeSet; //导入依赖的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);
}
}
示例6: initRegistry
import com.codahale.metrics.JvmAttributeGaugeSet; //导入依赖的package包/类
private void initRegistry() {
// add JVM statistics
metricRegistry.register("jvm.memory", new MemoryUsageGaugeSet());
metricRegistry.register("jvm.vm", new JvmAttributeGaugeSet());
metricRegistry.register("jvm.garbage-collectors", new GarbageCollectorMetricSet());
metricRegistry.register("jvm.thread-states", new ThreadStatesGaugeSet());
if (hBaseAsyncOperationMetrics != null) {
Map<String, Metric> metrics = hBaseAsyncOperationMetrics.getMetrics();
for (Map.Entry<String, Metric> metric : metrics.entrySet()) {
metricRegistry.register(metric.getKey(), metric.getValue());
}
}
}
示例7: testJVM
import com.codahale.metrics.JvmAttributeGaugeSet; //导入依赖的package包/类
@Test
public void testJVM() throws InterruptedException {
METRIC_REGISTRY.register("jvm.memory", new MemoryUsageGaugeSet());
METRIC_REGISTRY.register("jvm.vm", new JvmAttributeGaugeSet());
METRIC_REGISTRY.register("jvm.gc", new GarbageCollectorMetricSet());
METRIC_REGISTRY.register("jvm.thread", new ThreadStatesGaugeSet());
METRIC_REGISTRY.register("jvm.class", new ClassLoadingGaugeSet());
METRIC_REGISTRY.register("jvm.fd", new FileDescriptorRatioGauge());
Thread.sleep(5 * 1000);
}
示例8: MetricsServlet
import com.codahale.metrics.JvmAttributeGaugeSet; //导入依赖的package包/类
@Inject
public MetricsServlet(final MetricRegistry registry) {
super(registry);
// JVM metrics are no longer automatically added in codahale-metrics
registry.register(name("jvm", "vm"), new JvmAttributeGaugeSet());
registry.register(name("jvm", "memory"), new MemoryUsageGaugeSet());
registry.register(name("jvm", "buffers"), new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
registry.register(name("jvm", "fd_usage"), new FileDescriptorRatioGauge());
registry.register(name("jvm", "thread-states"), new ThreadStatesGaugeSet());
registry.register(name("jvm", "garbage-collectors"), new GarbageCollectorMetricSet());
}
示例9: registerJvmAttributeMonitor
import com.codahale.metrics.JvmAttributeGaugeSet; //导入依赖的package包/类
public JvmAttributeGaugeSet registerJvmAttributeMonitor(MonitorName monitorName) {
if (monitorName == null) {
throw new NullPointerException("monitorName must not be null");
}
return this.delegate.register(monitorName.getName(), new JvmAttributeGaugeSet());
}