Search in sources :

Example 6 with AggregateMetric

use of org.apache.solr.metrics.AggregateMetric in project lucene-solr by apache.

the class MetricUtils method convertMetrics.

/**
   * Convert selected metrics from a registry into maps (when <code>compact==false</code>) or
   * flattened objects.
   * @param registry registry
   * @param names metric names
   * @param skipHistograms discard any {@link Histogram}-s and histogram parts of {@link Timer}-s.
   * @param skipAggregateValues discard internal values of {@link AggregateMetric}-s.
   * @param compact use compact representation for counters and gauges.
   * @param simple use simplified representation for complex metrics - instead of a (name, map)
   *             only the selected (name "." key, value) pairs will be produced.
   * @param consumer consumer that accepts produced objects
   */
public static void convertMetrics(MetricRegistry registry, Collection<String> names, boolean skipHistograms, boolean skipAggregateValues, boolean compact, boolean simple, BiConsumer<String, Object> consumer) {
    final Map<String, Metric> metrics = registry.getMetrics();
    names.stream().forEach(n -> {
        Metric metric = metrics.get(n);
        convertMetric(n, metric, PropertyFilter.ALL, skipHistograms, skipAggregateValues, compact, simple, consumer);
    });
}
Also used : AggregateMetric(org.apache.solr.metrics.AggregateMetric) Metric(com.codahale.metrics.Metric)

Aggregations

AggregateMetric (org.apache.solr.metrics.AggregateMetric)6 Metric (com.codahale.metrics.Metric)4 Counter (com.codahale.metrics.Counter)3 Histogram (com.codahale.metrics.Histogram)3 Meter (com.codahale.metrics.Meter)3 Timer (com.codahale.metrics.Timer)3 Test (org.junit.Test)3 Gauge (com.codahale.metrics.Gauge)2 MetricRegistry (com.codahale.metrics.MetricRegistry)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 CoreContainer (org.apache.solr.core.CoreContainer)2 SolrMetricManager (org.apache.solr.metrics.SolrMetricManager)2 InstrumentedExecutorService (com.codahale.metrics.InstrumentedExecutorService)1 MetricFilter (com.codahale.metrics.MetricFilter)1 Snapshot (com.codahale.metrics.Snapshot)1 BeanInfo (java.beans.BeanInfo)1 IntrospectionException (java.beans.IntrospectionException)1 Introspector (java.beans.Introspector)1 PropertyDescriptor (java.beans.PropertyDescriptor)1