Search in sources :

Example 16 with GarbageCollectorMetricSet

use of com.codahale.metrics.jvm.GarbageCollectorMetricSet in project alien4cloud by alien4cloud.

the class MetricsConfiguration method init.

@PostConstruct
public void init() {
    log.info("Registering JVM gauges");
    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()));
    if (propertyResolver.getProperty(PROP_JMX_ENABLED, Boolean.class, false)) {
        log.info("Initializing Metrics JMX reporting");
        jmxReporter = JmxReporter.forRegistry(METRIC_REGISTRY).build();
        jmxReporter.start();
    }
}
Also used : BufferPoolMetricSet(com.codahale.metrics.jvm.BufferPoolMetricSet) FileDescriptorRatioGauge(com.codahale.metrics.jvm.FileDescriptorRatioGauge) MemoryUsageGaugeSet(com.codahale.metrics.jvm.MemoryUsageGaugeSet) ThreadStatesGaugeSet(com.codahale.metrics.jvm.ThreadStatesGaugeSet) GarbageCollectorMetricSet(com.codahale.metrics.jvm.GarbageCollectorMetricSet) PostConstruct(javax.annotation.PostConstruct)

Example 17 with GarbageCollectorMetricSet

use of com.codahale.metrics.jvm.GarbageCollectorMetricSet in project incubator-gobblin by apache.

the class JMXReportingService method registerJvmMetrics.

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());
    }
}
Also used : FileDescriptorRatioGauge(com.codahale.metrics.jvm.FileDescriptorRatioGauge) MemoryUsageGaugeSet(com.codahale.metrics.jvm.MemoryUsageGaugeSet) ThreadStatesGaugeSet(com.codahale.metrics.jvm.ThreadStatesGaugeSet) ImmutableMap(com.google.common.collect.ImmutableMap) Map(java.util.Map) GarbageCollectorMetricSet(com.codahale.metrics.jvm.GarbageCollectorMetricSet) MetricSet(com.codahale.metrics.MetricSet) GarbageCollectorMetricSet(com.codahale.metrics.jvm.GarbageCollectorMetricSet)

Example 18 with GarbageCollectorMetricSet

use of com.codahale.metrics.jvm.GarbageCollectorMetricSet in project chassis by Kixeye.

the class MetricsConfiguration method metricRegistry.

/**
 * Initializes the metrics registry
 *
 * @return metric registry bean
 */
@Bean
public MetricRegistry metricRegistry() {
    final MetricRegistry bean = new MetricRegistry();
    // add JVM metrics
    bean.register("jvm.gc", new GarbageCollectorMetricSet());
    bean.register("jvm.memory", new MemoryUsageGaugeSet());
    bean.register("jvm.thread-states", new ThreadStatesGaugeSet());
    bean.register("jvm.fd", new FileDescriptorRatioGauge());
    return bean;
}
Also used : FileDescriptorRatioGauge(com.codahale.metrics.jvm.FileDescriptorRatioGauge) MemoryUsageGaugeSet(com.codahale.metrics.jvm.MemoryUsageGaugeSet) MetricRegistry(com.codahale.metrics.MetricRegistry) ThreadStatesGaugeSet(com.codahale.metrics.jvm.ThreadStatesGaugeSet) GarbageCollectorMetricSet(com.codahale.metrics.jvm.GarbageCollectorMetricSet) Bean(org.springframework.context.annotation.Bean)

Example 19 with GarbageCollectorMetricSet

use of com.codahale.metrics.jvm.GarbageCollectorMetricSet in project riposte by Nike-Inc.

the class CodahaleMetricsEngine method reportJvmMetrics.

/**
 * 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;
}
Also used : BufferPoolMetricSet(com.codahale.metrics.jvm.BufferPoolMetricSet) MemoryUsageGaugeSet(com.codahale.metrics.jvm.MemoryUsageGaugeSet) ThreadStatesGaugeSet(com.codahale.metrics.jvm.ThreadStatesGaugeSet) GarbageCollectorMetricSet(com.codahale.metrics.jvm.GarbageCollectorMetricSet)

Example 20 with GarbageCollectorMetricSet

use of com.codahale.metrics.jvm.GarbageCollectorMetricSet in project incubator-ratis by apache.

the class JVMMetrics method addJvmMetrics.

static void addJvmMetrics(MetricRegistries registries) {
    MetricRegistryInfo info = new MetricRegistryInfo("jvm", "ratis_jvm", "jvm", "jvm metrics");
    RatisMetricRegistry registry = registries.create(info);
    registry.registerAll("gc", new GarbageCollectorMetricSet());
    registry.registerAll("memory", new MemoryUsageGaugeSet());
    registry.registerAll("threads", new ThreadStatesGaugeSet());
    registry.registerAll("classLoading", new ClassLoadingGaugeSet());
}
Also used : MemoryUsageGaugeSet(com.codahale.metrics.jvm.MemoryUsageGaugeSet) ClassLoadingGaugeSet(com.codahale.metrics.jvm.ClassLoadingGaugeSet) ThreadStatesGaugeSet(com.codahale.metrics.jvm.ThreadStatesGaugeSet) GarbageCollectorMetricSet(com.codahale.metrics.jvm.GarbageCollectorMetricSet)

Aggregations

GarbageCollectorMetricSet (com.codahale.metrics.jvm.GarbageCollectorMetricSet)23 MemoryUsageGaugeSet (com.codahale.metrics.jvm.MemoryUsageGaugeSet)23 ThreadStatesGaugeSet (com.codahale.metrics.jvm.ThreadStatesGaugeSet)17 FileDescriptorRatioGauge (com.codahale.metrics.jvm.FileDescriptorRatioGauge)11 BufferPoolMetricSet (com.codahale.metrics.jvm.BufferPoolMetricSet)10 MetricRegistry (com.codahale.metrics.MetricRegistry)8 ClassLoadingGaugeSet (com.codahale.metrics.jvm.ClassLoadingGaugeSet)8 Bean (org.springframework.context.annotation.Bean)4 Map (java.util.Map)3 PostConstruct (javax.annotation.PostConstruct)3 LoggerContext (ch.qos.logback.classic.LoggerContext)2 JmxReporter (com.codahale.metrics.JmxReporter)2 MetricSet (com.codahale.metrics.MetricSet)2 InstrumentedAppender (com.codahale.metrics.logback.InstrumentedAppender)2 IOException (java.io.IOException)2 Logger (ch.qos.logback.classic.Logger)1 JvmAttributeGaugeSet (com.codahale.metrics.JvmAttributeGaugeSet)1 Metric (com.codahale.metrics.Metric)1 Timer (com.codahale.metrics.Timer)1 CachedThreadStatesGaugeSet (com.codahale.metrics.jvm.CachedThreadStatesGaugeSet)1