private void registerJvmMetrics() { this.registry.register("MEMORY_Gauge", new MemoryUsageGaugeSet()); this.registry.register("GC_Gauge", new GarbageCollectorMetricSet()); this.registry.register("Thread_State_Gauge", new ThreadStatesGaugeSet()); }
private int getThreadCount(Thread.State state) { final ThreadInfo[] allThreads = getThreadInfo(); int count = 0; for (ThreadInfo info : allThreads) { if (info != null && info.getThreadState() == state) { count++; } } return count; }
@Override public Map<String, Metric> getMetrics() { final Map<String, Metric> gauges = new HashMap<>(); for (final Thread.State state : Thread.State.values()) { gauges.put(name(state.toString().toLowerCase(), "count"), (Gauge<Object>) () -> getThreadCount(state)); } gauges.put("count", (Gauge<Integer>) threads::getThreadCount); gauges.put("daemon.count", (Gauge<Integer>) threads::getDaemonThreadCount); gauges.put("deadlock.count", (Gauge<Integer>) () -> deadlockDetector.getDeadlockedThreads().size()); gauges.put("deadlocks", (Gauge<Set<String>>) deadlockDetector::getDeadlockedThreads); return Collections.unmodifiableMap(gauges); }
public MetricRegistryProvider() { this.metricRegistry = new MetricRegistry(); metricRegistry.register("jvm.buffers", new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); metricRegistry.register("jvm.cl", new ClassLoadingGaugeSet()); metricRegistry.register("jvm.gc", new GarbageCollectorMetricSet()); metricRegistry.register("jvm.memory", new MemoryUsageGaugeSet()); metricRegistry.register("jvm.threads", new ThreadStatesGaugeSet()); }
private void registerJvmMetrics() { registerMetricSetWithPrefix("jvm.gc", new GarbageCollectorMetricSet()); registerMetricSetWithPrefix("jvm.memory", new MemoryUsageGaugeSet()); registerMetricSetWithPrefix("jvm.threads", new ThreadStatesGaugeSet()); this.metricRegistry.register("jvm.fileDescriptorRatio", new FileDescriptorRatioGauge()); for (Map.Entry<String, MetricSet> metricSet : this.additionalMetricSets.entrySet()) { registerMetricSetWithPrefix(metricSet.getKey(), metricSet.getValue()); } }
/** * Registers the JVM metrics to the metric registry and start to report * the registry metrics via JMX. */ public void registerMetrics() { if (metricsAreRegistered) { return; } getMetricRegistry().register("jvm.attribute", new JvmAttributeGaugeSet()); getMetricRegistry().register("jvm.buffers", new BufferPoolMetricSet(ManagementFactory .getPlatformMBeanServer())); getMetricRegistry().register("jvm.classloader", new ClassLoadingGaugeSet()); getMetricRegistry().register("jvm.filedescriptor", new FileDescriptorRatioGauge()); getMetricRegistry().register("jvm.gc", new GarbageCollectorMetricSet()); getMetricRegistry().register("jvm.memory", new MemoryUsageGaugeSet()); getMetricRegistry().register("jvm.threads", new ThreadStatesGaugeSet()); JmxReporter.forRegistry(metricRegistry).build().start(); metricsAreRegistered = true; }
registerAll("buffers", new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); registerAll("memory", new MemoryUsageGaugeSet()); registerAll("threads", new ThreadStatesGaugeSet()); registerAll("classLoading", new ClassLoadingGaugeSet());
registerAll("jvm.threads", new ThreadStatesGaugeSet()); registerAll("jvm.classes", new ClassLoadingGaugeSet());
registry.registerAll(new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); registry.registerAll(new MemoryUsageGaugeSet()); registry.registerAll(new ThreadStatesGaugeSet()); registry.registerAll(new ClassLoadingGaugeSet());
private static void registerSystemMetrics() { REGISTRY.registerAll(new GarbageCollectorMetricSet()); REGISTRY.registerAll(new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); REGISTRY.registerAll(new MemoryUsageGaugeSet()); REGISTRY.registerAll(new ThreadStatesGaugeSet()); REGISTRY.registerAll(new CpuGaugeSet()); register("fd.usage", new FileDescriptorRatioGauge()); }
/** * Registers the JVM metrics to the metric registry and start to report * the registry metrics via JMX. */ public void registerMetrics() { if (metricsAreRegistered) { return; } getMetricRegistry().register("jvm.attribute", new JvmAttributeGaugeSet()); getMetricRegistry().register("jvm.buffers", new BufferPoolMetricSet(ManagementFactory .getPlatformMBeanServer())); getMetricRegistry().register("jvm.classloader", new ClassLoadingGaugeSet()); getMetricRegistry().register("jvm.filedescriptor", new FileDescriptorRatioGauge()); getMetricRegistry().register("jvm.gc", new GarbageCollectorMetricSet()); getMetricRegistry().register("jvm.memory", new MemoryUsageGaugeSet()); getMetricRegistry().register("jvm.threads", new ThreadStatesGaugeSet()); JmxReporter.forRegistry(metricRegistry).build().start(); metricsAreRegistered = true; }
registerAll("jvm.gc", new GarbageCollectorMetricSet()); registerAll("jvm.memory", new MemoryUsageGaugeSet()); registerAll("jvm.threads", new ThreadStatesGaugeSet()); registerAll("jvm.classes", new ClassLoadingGaugeSet());
/** * Register a set of gauges for the number of threads in their various * states and deadlock detection. * * @return instance of MetricsContainer. */ MetricsContainer registerThreadStatesGauge() { metrics.register( MetricRegistry.name("jvm", "thread-states"), new ThreadStatesGaugeSet()); return this; }
private void registerJvmMetrics() { this.registry.register("MEMORY_Gauge", new MemoryUsageGaugeSet()); this.registry.register("GC_Gauge", new GarbageCollectorMetricSet()); this.registry.register("Thread_State_Gauge", new ThreadStatesGaugeSet()); }
@Activate protected void activate() { metricRegistry.register(MetricRegistry.name(PREFIX, "gc"), new GarbageCollectorMetricSet()); metricRegistry.register(MetricRegistry.name(PREFIX, "buffers"), new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); metricRegistry.register(MetricRegistry.name(PREFIX, "memory"), new MemoryUsageGaugeSet()); metricRegistry.register(MetricRegistry.name(PREFIX, "threads"), new ThreadStatesGaugeSet()); metricRegistry.register(MetricRegistry.name(PREFIX, "classLoaders"), new ClassLoadingGaugeSet()); }
@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()); }
/** * Add metrics for JVM. Already provided by metrics-jvm */ private void monitorJvmMetrics() { logger.info("Registering JVM metrics"); metricRegistry.register(METRIC_JVM_GARBAGE, new GarbageCollectorMetricSet()); metricRegistry.register(METRIC_JVM_MEMORY, new MemoryUsageGaugeSet()); metricRegistry.register(METRIC_JVM_THREADS, new ThreadStatesGaugeSet()); metricRegistry.register(METRIC_JVM_CLASSLOADING, new ClassLoadingGaugeSet()); }
public MetricRegistryProvider() { this.metricRegistry = new MetricRegistry(); metricRegistry.register("jvm.buffers", new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); metricRegistry.register("jvm.cl", new ClassLoadingGaugeSet()); metricRegistry.register("jvm.gc", new GarbageCollectorMetricSet()); metricRegistry.register("jvm.memory", new MemoryUsageGaugeSet()); metricRegistry.register("jvm.threads", new ThreadStatesGaugeSet()); }
public MetricRegistryProvider() { this.metricRegistry = new MetricRegistry(); metricRegistry.register("jvm.buffers", new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); metricRegistry.register("jvm.cl", new ClassLoadingGaugeSet()); metricRegistry.register("jvm.gc", new GarbageCollectorMetricSet()); metricRegistry.register("jvm.memory", new MemoryUsageGaugeSet()); metricRegistry.register("jvm.threads", new ThreadStatesGaugeSet()); }
@Inject public MetricsService(Services services, MetricRegistry metricRegistry) { this.metricRegistry = metricRegistry; metricRegistry.register("jvm.buffers", new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer())); metricRegistry.register("jvm.gc", new GarbageCollectorMetricSet()); metricRegistry.register("jvm.memory", new MemoryUsageGaugeSet()); metricRegistry.register("jvm.threads", new ThreadStatesGaugeSet()); services.add(this); }