本文整理汇总了Java中com.codahale.metrics.jvm.BufferPoolMetricSet类的典型用法代码示例。如果您正苦于以下问题:Java BufferPoolMetricSet类的具体用法?Java BufferPoolMetricSet怎么用?Java BufferPoolMetricSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BufferPoolMetricSet类属于com.codahale.metrics.jvm包,在下文中一共展示了BufferPoolMetricSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JvmMetricSet
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的package包/类
public JvmMetricSet() {
registerSet("jvm.buffers", new BufferPoolMetricSet(getPlatformMBeanServer()));
registerSet("jvm.classloading", new ClassLoadingGaugeSet());
registerSet("jvm.fd", new FileDescriptorMetrics());
registerSet("jvm.gc", new GarbageCollectorMetricSet());
registerSet("jvm.memory", new MemoryUsageGaugeSet());
registerSet("jvm.thread", new CachedThreadStatesGaugeSet(60, TimeUnit.SECONDS));
metrics.put("jvm.uptime", new UptimeGauge());
try {
metrics.put("jvm.processCPU", new ProcessCpuTicksGauge());
} catch (ClassNotFoundException | IOException e) {
LOGGER.error("Error fetching process CPU usage metrics.", e);
}
}
示例2: build
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的package包/类
public CloudWatchReporter build() {
if (withJvmMetrics) {
metricRegistry.register("jvm.uptime", (Gauge<Long>) () -> ManagementFactory.getRuntimeMXBean().getUptime());
metricRegistry.register("jvm.current_time", (Gauge<Long>) clock::getTime);
metricRegistry.register("jvm.classes", new ClassLoadingGaugeSet());
metricRegistry.register("jvm.fd_usage", new FileDescriptorRatioGauge());
metricRegistry.register("jvm.buffers", new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
metricRegistry.register("jvm.gc", new GarbageCollectorMetricSet());
metricRegistry.register("jvm.memory", new MemoryUsageGaugeSet());
metricRegistry.register("jvm.thread-states", new ThreadStatesGaugeSet());
}
cwRateUnit = toStandardUnit(rateUnit);
cwDurationUnit = toStandardUnit(durationUnit);
return new CloudWatchReporter(this);
}
开发者ID:azagniotov,项目名称:codahale-aggregated-metrics-cloudwatch-reporter,代码行数:19,代码来源:CloudWatchReporter.java
示例3: enableJvm
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的package包/类
public static void enableJvm() {
if (bEnableJvm)
return;
METRIC_REGISTRY.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
METRIC_REGISTRY.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet());
METRIC_REGISTRY.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet());
METRIC_REGISTRY.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
METRIC_REGISTRY.register(PROP_METRIC_REG_JVM_BUFFERS,
new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
final JmxReporter jmxReporter = JmxReporter.forRegistry(METRIC_REGISTRY).build();
jmxReporter.start();
bEnableJvm = true;
}
示例4: onStartup
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的package包/类
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
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()));
servletContext.setAttribute(InstrumentedFilter.REGISTRY_ATTRIBUTE, metricRegistry);
FilterRegistration.Dynamic metricsFilter =
servletContext.addFilter("webappMetricsFilter", new InstrumentedFilter());
metricsFilter.addMappingForUrlPatterns(
EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD, DispatcherType.ASYNC), true,
"/*");
metricsFilter.setAsyncSupported(true);
}
示例5: configureJvmMetrics
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的package包/类
private static void configureJvmMetrics(MetricRegistry registry) {
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
registry.register("jvm.buffer-pool", new BufferPoolMetricSet(mBeanServer));
registry.register("jvm.class-loading", new ClassLoadingGaugeSet());
registry.register("jvm.file-descriptor-ratio", new FileDescriptorRatioGauge());
registry.register("jvm.gc", new GarbageCollectorMetricSet());
registry.register("jvm.memory", new MemoryUsageGaugeSet());
registry.register("jvm.threads", new ThreadStatesGaugeSet());
}
示例6: init
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的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 (propertyResolver.getProperty(PROP_JMX_ENABLED, Boolean.class, false)) {
log.info("Initializing Metrics JMX reporting");
JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();
jmxReporter.start();
}
}
示例7: reportJvmMetrics
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的package包/类
/**
* Adds JVM MetricSets to this engine. By default JVM metrics are not placed in the Registry
*/
public CodahaleMetricsEngine reportJvmMetrics() {
// add JVM metrics
if (!jvmMetricsAdded) {
metricsCollector.registerAll("JVM-gc", new GarbageCollectorMetricSet());
metricsCollector
.registerAll("JVM-buffers", new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
metricsCollector.registerAll("JVM-memory", new MemoryUsageGaugeSet());
metricsCollector.registerAll("JVM-threads", new ThreadStatesGaugeSet());
jvmMetricsAdded = true;
}
return this;
}
示例8: init
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的package包/类
@PostConstruct
public void init() {
log.debug("Registering JVM gauges");
metricRegistry.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
metricRegistry.register(PROP_METRIC_REG_JCACHE_STATISTICS, new JCacheGaugeSet());
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);
}
}
示例9: registerSystemMetrics
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的package包/类
private static void registerSystemMetrics() {
REGISTRY.registerAll(new GarbageCollectorMetricSet());
REGISTRY.registerAll(new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
REGISTRY.registerAll(new MemoryUsageGaugeSet());
REGISTRY.registerAll(new ThreadStatesGaugeSet());
register("fd.usage", new FileDescriptorRatioGauge());
}
示例10: MetricsServlet
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的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());
}
示例11: startVerticle
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的package包/类
@Override
protected void startVerticle() {
m_sharedData = vertx.sharedData().getMap(SHARED_METRICS_KEY);
// OSHI system information
SystemInfo systemInfo = new SystemInfo();
m_oshiMetrics = new OshiMetrics(systemInfo);
m_oshiMetrics.init();
// Java OS MXBean information
m_osMXBeanMetrics = new OSMXBeanMetrics();
m_osMXBeanMetrics.init();
// Register metrics
m_registry = new MetricRegistry();
logger().debug("Registering JVM garbage collection metric set");
registerMetrics("jvm.gc", new GarbageCollectorMetricSet(), m_registry);
logger().debug("Registering JMV buffer metric set");
registerMetrics("jvm.buffers", new BufferPoolMetricSet(
ManagementFactory.getPlatformMBeanServer()), m_registry);
logger().debug("Registering JMV memory usage metric set");
registerMetrics("jvm.memory", new MemoryUsageGaugeSet(), m_registry);
logger().debug("Registering JMV thread states metric set");
registerMetrics("jvm.threads", new ThreadStatesGaugeSet(), m_registry);
// Aggregate metrics
registerAggregateMetrics(m_registry);
// Output system information
outputSysInfo(systemInfo);
}
示例12: init
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的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();
}
}
示例13: registerJVMMetrics
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的package包/类
private void registerJVMMetrics() {
registerAllJVMMetrics(Level.INFO, "jvm.memory", new MemoryUsageGaugeSet());
registerAllJVMMetrics(Level.INFO, "jvm.os", new OperatingSystemMetricSet());
registerAllJVMMetrics(Level.INFO, "jvm.class-loading", new ClassLoadingGaugeSet());
registerAllJVMMetrics(Level.DEBUG, "jvm.gc", new GarbageCollectorMetricSet());
registerAllJVMMetrics(Level.DEBUG, "jvm.threads", new ThreadStatesGaugeSet());
registerAllJVMMetrics(Level.TRACE, "jvm.buffers",
new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
}
示例14: provideMetrics
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的package包/类
@Provides @Singleton MetricRegistry provideMetrics() {
MetricRegistry metrics = new MetricRegistry();
metrics.register("jvm.memory", new MemoryUsageGaugeSet());
metrics.register("jvm.garbage", new GarbageCollectorMetricSet());
metrics.register("jvm.threads", new ThreadStatesGaugeSet());
metrics.register("jvm.files", new FileDescriptorRatioGauge());
metrics.register("jvm.buffers", new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
return metrics;
}
示例15: init
import com.codahale.metrics.jvm.BufferPoolMetricSet; //导入依赖的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 (applicationProperties.getMetrics().getJmx().isEnabled()) {
log.debug("Initializing Metrics JMX reporting");
JmxReporter jmxReporter = JmxReporter.forRegistry(metricRegistry).build();
jmxReporter.start();
}
}