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());
}
}
}
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;
}
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;
}
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;
}
}
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;
}
Aggregations