com.codahale.metrics.jvm.JvmAttributeGaugeSet Java Examples

The following examples show how to use com.codahale.metrics.jvm.JvmAttributeGaugeSet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MetricsServlet.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@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());

  // Export to Prometheus
  new DropwizardExports(registry).register();
}
 
Example #2
Source File: DefaultMetricsService.java    From knox with Apache License 2.0 5 votes vote down vote up
private void registerJvmMetricSets() {
  metrics.registerAll(new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
  metrics.registerAll(new CachedThreadStatesGaugeSet(5, TimeUnit.MINUTES));
  metrics.registerAll(new ClassLoadingGaugeSet());
  metrics.registerAll(new GarbageCollectorMetricSet());
  metrics.registerAll(new JvmAttributeGaugeSet());
  metrics.registerAll(new MemoryUsageGaugeSet());
}
 
Example #3
Source File: JmxJvmMetrics.java    From nifi with Apache License 2.0 5 votes vote down vote up
public static JmxJvmMetrics getInstance() {
    if (metricRegistry.get() == null) {
        metricRegistry.set(new MetricRegistry());
        metricRegistry.get().register(REGISTRY_METRICSET_JVM_ATTRIBUTES, new JvmAttributeGaugeSet());
        metricRegistry.get().register(REGISTRY_METRICSET_MEMORY, new MemoryUsageGaugeSet());
        metricRegistry.get().register(REGISTRY_METRICSET_THREADS, new ThreadStatesGaugeSet());
        metricRegistry.get().register(REGISTRY_METRICSET_GARBAGE_COLLECTORS, new GarbageCollectorMetricSet());
        metricRegistry.get().register(OS_FILEDESCRIPTOR_USAGE, new FileDescriptorRatioGauge());

    }
    return new JmxJvmMetrics();
}
 
Example #4
Source File: MetricsConfiguration.java    From JuniperBot with GNU General Public License v3.0 4 votes vote down vote up
@Bean
public JvmAttributeGaugeSet jvmGauge() {
    JvmAttributeGaugeSet jvmMetrics = new JvmAttributeGaugeSet();
    metricRegistry.register("jvm", jvmMetrics);
    return jvmMetrics;
}