Search in sources :

Example 1 with AltBufferPoolMetricSet

use of org.apache.solr.metrics.AltBufferPoolMetricSet 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)

Aggregations

ClassLoadingGaugeSet (com.codahale.metrics.jvm.ClassLoadingGaugeSet)1 GarbageCollectorMetricSet (com.codahale.metrics.jvm.GarbageCollectorMetricSet)1 MemoryUsageGaugeSet (com.codahale.metrics.jvm.MemoryUsageGaugeSet)1 ThreadStatesGaugeSet (com.codahale.metrics.jvm.ThreadStatesGaugeSet)1 IOException (java.io.IOException)1 ServletException (javax.servlet.ServletException)1 UnavailableException (javax.servlet.UnavailableException)1 SolrException (org.apache.solr.common.SolrException)1 AltBufferPoolMetricSet (org.apache.solr.metrics.AltBufferPoolMetricSet)1 MetricsMap (org.apache.solr.metrics.MetricsMap)1 OperatingSystemMetricSet (org.apache.solr.metrics.OperatingSystemMetricSet)1 SolrMetricManager (org.apache.solr.metrics.SolrMetricManager)1