Search in sources :

Example 36 with Metric

use of com.codahale.metrics.Metric 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 37 with Metric

use of com.codahale.metrics.Metric in project pinpoint by naver.

the class GarbageCollectorMetricProvider method get.

@Override
public GarbageCollectorMetric get() {
    Map<String, Metric> garbageCollectorMetrics = garbageCollectorMetricSet.getMetrics();
    Set<String> metricNames = garbageCollectorMetrics.keySet();
    GarbageCollectorMetric garbageCollectorMetric;
    if (metricNames.contains(MetricMonitorValues.METRIC_GC_SERIAL_OLDGEN_COUNT)) {
        garbageCollectorMetric = new SerialGcGarbageCollectorMetric(garbageCollectorMetrics);
    } else if (metricNames.contains(MetricMonitorValues.METRIC_GC_PS_OLDGEN_COUNT)) {
        garbageCollectorMetric = new ParallelGcGarbageCollectorMetric(garbageCollectorMetrics);
    } else if (metricNames.contains(MetricMonitorValues.METRIC_GC_CMS_OLDGEN_COUNT)) {
        garbageCollectorMetric = new CmsGcGarbageCollectorMetric(garbageCollectorMetrics);
    } else if (metricNames.contains(MetricMonitorValues.METRIC_GC_G1_OLDGEN_COUNT)) {
        garbageCollectorMetric = new G1GcGarbageCollectorMetric(garbageCollectorMetrics);
    } else {
        garbageCollectorMetric = new UnknownGarbageCollectorMetric();
    }
    logger.info("loaded : {}", garbageCollectorMetric);
    return garbageCollectorMetric;
}
Also used : ParallelGcGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.ParallelGcGarbageCollectorMetric) G1GcGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.G1GcGarbageCollectorMetric) GarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.GarbageCollectorMetric) CmsGcGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.CmsGcGarbageCollectorMetric) UnknownGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.UnknownGarbageCollectorMetric) SerialGcGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.SerialGcGarbageCollectorMetric) ParallelGcGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.ParallelGcGarbageCollectorMetric) G1GcGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.G1GcGarbageCollectorMetric) CmsGcGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.CmsGcGarbageCollectorMetric) ParallelGcGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.ParallelGcGarbageCollectorMetric) Metric(com.codahale.metrics.Metric) G1GcGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.G1GcGarbageCollectorMetric) GarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.GarbageCollectorMetric) CmsGcGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.CmsGcGarbageCollectorMetric) UnknownGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.UnknownGarbageCollectorMetric) SerialGcGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.SerialGcGarbageCollectorMetric) SerialGcGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.SerialGcGarbageCollectorMetric) UnknownGarbageCollectorMetric(com.navercorp.pinpoint.profiler.monitor.metric.gc.UnknownGarbageCollectorMetric)

Example 38 with Metric

use of com.codahale.metrics.Metric in project pinpoint by naver.

the class MemoryMetricProvider method get.

@Override
public MemoryMetric get() {
    Map<String, Metric> memoryUsageMetrics = memoryUsageGaugeSet.getMetrics();
    Set<String> metricNames = memoryUsageMetrics.keySet();
    MemoryMetric memoryMetric;
    if (metricNames.contains(MetricMonitorValues.METRIC_MEMORY_POOLS_SERIAL_OLDGEN_USAGE)) {
        memoryMetric = new SerialGcMemoryMetric(memoryUsageMetrics);
    } else if (metricNames.contains(MetricMonitorValues.METRIC_MEMORY_POOLS_PS_OLDGEN_USAGE)) {
        memoryMetric = new ParallelGcMemoryMetric(memoryUsageMetrics);
    } else if (metricNames.contains(MetricMonitorValues.METRIC_MEMORY_POOLS_CMS_OLDGEN_USAGE)) {
        memoryMetric = new CmsGcMemoryMetric(memoryUsageMetrics);
    } else if (metricNames.contains(MetricMonitorValues.METRIC_MEMORY_POOLS_G1_OLDGEN_USAGE)) {
        memoryMetric = new G1GcMemoryMetric(memoryUsageMetrics);
    } else {
        memoryMetric = new UnknownMemoryMetric(memoryUsageMetrics);
    }
    logger.info("loaded : {}", memoryMetric);
    return memoryMetric;
}
Also used : SerialGcMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.SerialGcMemoryMetric) G1GcMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.G1GcMemoryMetric) ParallelGcMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.ParallelGcMemoryMetric) G1GcMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.G1GcMemoryMetric) Metric(com.codahale.metrics.Metric) CmsGcMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.CmsGcMemoryMetric) UnknownMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.UnknownMemoryMetric) SerialGcMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.SerialGcMemoryMetric) MemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.MemoryMetric) ParallelGcMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.ParallelGcMemoryMetric) CmsGcMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.CmsGcMemoryMetric) ParallelGcMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.ParallelGcMemoryMetric) G1GcMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.G1GcMemoryMetric) CmsGcMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.CmsGcMemoryMetric) UnknownMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.UnknownMemoryMetric) SerialGcMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.SerialGcMemoryMetric) MemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.MemoryMetric) UnknownMemoryMetric(com.navercorp.pinpoint.profiler.monitor.metric.memory.UnknownMemoryMetric)

Example 39 with Metric

use of com.codahale.metrics.Metric in project spring-boot by spring-projects.

the class DropwizardMetricServices method register.

@SuppressWarnings("unchecked")
private <T extends Metric> T register(String name, MetricRegistrar<T> registrar) {
    Reservoir reservoir = this.reservoirFactory.getReservoir(name);
    if (reservoir == null) {
        return registrar.register(this.registry, name);
    }
    Metric metric = this.registry.getMetrics().get(name);
    if (metric != null) {
        registrar.checkExisting(metric);
        return (T) metric;
    }
    try {
        return this.registry.register(name, registrar.createForReservoir(reservoir));
    } catch (IllegalArgumentException ex) {
        Metric added = this.registry.getMetrics().get(name);
        registrar.checkExisting(metric);
        return (T) added;
    }
}
Also used : Reservoir(com.codahale.metrics.Reservoir) Metric(com.codahale.metrics.Metric)

Example 40 with Metric

use of com.codahale.metrics.Metric in project graylog2-server by Graylog2.

the class MetricsResource method singleMetric.

@GET
@Timed
@Path("/{metricName}")
@ApiOperation(value = "Get a single metric")
@ApiResponses(value = { @ApiResponse(code = 404, message = "No such metric") })
@Produces(MediaType.APPLICATION_JSON)
public Metric singleMetric(@ApiParam(name = "metricName", required = true) @PathParam("metricName") String metricName) {
    checkPermission(RestPermissions.METRICS_READ, metricName);
    final Metric metric = metricRegistry.getMetrics().get(metricName);
    if (metric == null) {
        final String msg = "I do not have a metric called [" + metricName + "].";
        LOG.debug(msg);
        throw new NotFoundException(msg);
    }
    return metric;
}
Also used : NotFoundException(javax.ws.rs.NotFoundException) Metric(com.codahale.metrics.Metric) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

Metric (com.codahale.metrics.Metric)58 Test (org.junit.Test)27 MetricRegistry (com.codahale.metrics.MetricRegistry)16 Map (java.util.Map)16 HashMap (java.util.HashMap)13 Counter (com.codahale.metrics.Counter)10 Gauge (com.codahale.metrics.Gauge)10 Timer (com.codahale.metrics.Timer)10 MetricFilter (com.codahale.metrics.MetricFilter)8 MetricFilter (com.kixeye.chassis.support.metrics.MetricFilter)8 Meter (com.codahale.metrics.Meter)7 Histogram (com.codahale.metrics.Histogram)4 SolrMetricManager (org.apache.solr.metrics.SolrMetricManager)4 Timed (com.codahale.metrics.annotation.Timed)3 ApiOperation (io.swagger.annotations.ApiOperation)3 ApiResponses (io.swagger.annotations.ApiResponses)3 IOException (java.io.IOException)3 List (java.util.List)3 Random (java.util.Random)3 Collectors (java.util.stream.Collectors)3