Search in sources :

Example 6 with ThreadStatesGaugeSet

use of com.codahale.metrics.jvm.ThreadStatesGaugeSet in project pinpoint by naver.

the class CollectorMetric method initRegistry.

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());
        }
    }
}
Also used : JvmAttributeGaugeSet(com.codahale.metrics.JvmAttributeGaugeSet) MemoryUsageGaugeSet(com.codahale.metrics.jvm.MemoryUsageGaugeSet) Metric(com.codahale.metrics.Metric) ThreadStatesGaugeSet(com.codahale.metrics.jvm.ThreadStatesGaugeSet) Map(java.util.Map) GarbageCollectorMetricSet(com.codahale.metrics.jvm.GarbageCollectorMetricSet)

Example 7 with ThreadStatesGaugeSet

use of com.codahale.metrics.jvm.ThreadStatesGaugeSet 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 8 with ThreadStatesGaugeSet

use of com.codahale.metrics.jvm.ThreadStatesGaugeSet in project lucene-solr by apache.

the class SolrDispatchFilter method setupJvmMetrics.

private void setupJvmMetrics(CoreContainer coresInit) {
    SolrMetricManager metricManager = coresInit.getMetricManager();
    final Set<String> hiddenSysProps = coresInit.getConfig().getMetricsConfig().getHiddenSysProps();
    try {
        String registry = SolrMetricManager.getRegistryName(SolrInfoBean.Group.jvm);
        metricManager.registerAll(registry, new AltBufferPoolMetricSet(), true, "buffers");
        metricManager.registerAll(registry, new ClassLoadingGaugeSet(), true, "classes");
        metricManager.registerAll(registry, new OperatingSystemMetricSet(), true, "os");
        metricManager.registerAll(registry, new GarbageCollectorMetricSet(), true, "gc");
        metricManager.registerAll(registry, new MemoryUsageGaugeSet(), true, "memory");
        // todo should we use CachedThreadStatesGaugeSet instead?
        metricManager.registerAll(registry, new ThreadStatesGaugeSet(), true, "threads");
        MetricsMap sysprops = new MetricsMap((detailed, map) -> {
            System.getProperties().forEach((k, v) -> {
                if (!hiddenSysProps.contains(k)) {
                    map.put(String.valueOf(k), v);
                }
            });
        });
        metricManager.registerGauge(null, registry, sysprops, true, "properties", "system");
    } catch (Exception e) {
        log.warn("Error registering JVM metrics", e);
    }
}
Also used : MetricsMap(org.apache.solr.metrics.MetricsMap) MemoryUsageGaugeSet(com.codahale.metrics.jvm.MemoryUsageGaugeSet) OperatingSystemMetricSet(org.apache.solr.metrics.OperatingSystemMetricSet) SolrMetricManager(org.apache.solr.metrics.SolrMetricManager) AltBufferPoolMetricSet(org.apache.solr.metrics.AltBufferPoolMetricSet) ClassLoadingGaugeSet(com.codahale.metrics.jvm.ClassLoadingGaugeSet) ThreadStatesGaugeSet(com.codahale.metrics.jvm.ThreadStatesGaugeSet) ServletException(javax.servlet.ServletException) SolrException(org.apache.solr.common.SolrException) IOException(java.io.IOException) UnavailableException(javax.servlet.UnavailableException) GarbageCollectorMetricSet(com.codahale.metrics.jvm.GarbageCollectorMetricSet)

Example 9 with ThreadStatesGaugeSet

use of com.codahale.metrics.jvm.ThreadStatesGaugeSet in project cas by apereo.

the class CasMetricsConfiguration method metrics.

/**
 * Metric registry metric registry.
 *
 * @return the metric registry
 */
@RefreshScope
@Bean
public MetricRegistry metrics() {
    final MetricRegistry metrics = new MetricRegistry();
    metrics.register("jvm.gc", new GarbageCollectorMetricSet());
    metrics.register("jvm.memory", new MemoryUsageGaugeSet());
    metrics.register("thread-states", new ThreadStatesGaugeSet());
    metrics.register("jvm.fd.usage", new FileDescriptorRatioGauge());
    return metrics;
}
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) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Aggregations

GarbageCollectorMetricSet (com.codahale.metrics.jvm.GarbageCollectorMetricSet)9 MemoryUsageGaugeSet (com.codahale.metrics.jvm.MemoryUsageGaugeSet)9 ThreadStatesGaugeSet (com.codahale.metrics.jvm.ThreadStatesGaugeSet)9 FileDescriptorRatioGauge (com.codahale.metrics.jvm.FileDescriptorRatioGauge)5 MetricRegistry (com.codahale.metrics.MetricRegistry)3 BufferPoolMetricSet (com.codahale.metrics.jvm.BufferPoolMetricSet)3 ClassLoadingGaugeSet (com.codahale.metrics.jvm.ClassLoadingGaugeSet)3 Bean (org.springframework.context.annotation.Bean)3 LoggerContext (ch.qos.logback.classic.LoggerContext)2 JmxReporter (com.codahale.metrics.JmxReporter)2 JvmAttributeGaugeSet (com.codahale.metrics.JvmAttributeGaugeSet)2 InstrumentedAppender (com.codahale.metrics.logback.InstrumentedAppender)2 Logger (ch.qos.logback.classic.Logger)1 Metric (com.codahale.metrics.Metric)1 IOException (java.io.IOException)1 OperatingSystemMXBean (java.lang.management.OperatingSystemMXBean)1 Map (java.util.Map)1 PostConstruct (javax.annotation.PostConstruct)1 ServletException (javax.servlet.ServletException)1 UnavailableException (javax.servlet.UnavailableException)1