use of com.codahale.metrics.jvm.GarbageCollectorMetricSet 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());
}
}
if (bulkOperationMetrics != null) {
Map<String, Metric> metrics = bulkOperationMetrics.getMetrics();
for (Map.Entry<String, Metric> metric : metrics.entrySet()) {
metricRegistry.register(metric.getKey(), metric.getValue());
}
}
}
use of com.codahale.metrics.jvm.GarbageCollectorMetricSet in project infrautils by opendaylight.
the class MetricProviderImpl method setUpJvmMetrics.
private static void setUpJvmMetrics(MetricRegistry registry) {
ThreadDeadlockDetector threadDeadlockDetector = new ThreadDeadlockDetector();
FileDescriptorRatioGauge fileDescriptorRatioGauge = new FileDescriptorRatioGauge();
registry.registerAll(new GarbageCollectorMetricSet());
registry.registerAll(new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
registry.registerAll(new CachedThreadStatesGaugeSet(getThreadMXBean(), threadDeadlockDetector, 13, SECONDS));
registry.registerAll(new MemoryUsageGaugeSet());
registry.registerAll(new ClassLoadingGaugeSet());
registry.gauge("odl.infrautils.FileDescriptorRatio", () -> fileDescriptorRatioGauge);
}
use of com.codahale.metrics.jvm.GarbageCollectorMetricSet in project ninja by ninjaframework.
the class MetricsServiceImpl method start.
@Start(order = 10)
@Override
public void start() {
String applicationName = ninjaProps.getWithDefault(NinjaConstant.applicationName, "Ninja");
/*
* Register optional metrics
*/
if (ninjaProps.getBooleanWithDefault("metrics.jvm.enabled", false)) {
registerAll("jvm.gc", new GarbageCollectorMetricSet());
registerAll("jvm.memory", new MemoryUsageGaugeSet());
registerAll("jvm.threads", new ThreadStatesGaugeSet());
registerAll("jvm.classes", new ClassLoadingGaugeSet());
log.debug("Registered JVM-Metrics integration");
}
if (ninjaProps.getBooleanWithDefault("metrics.logback.enabled", false)) {
final LoggerContext factory = (LoggerContext) LoggerFactory.getILoggerFactory();
final ch.qos.logback.classic.Logger root = factory.getLogger(Logger.ROOT_LOGGER_NAME);
final InstrumentedAppender appender = new InstrumentedAppender(metricRegistry);
appender.setContext(root.getLoggerContext());
appender.start();
root.addAppender(appender);
log.debug("Registered Logback-Metrics integration");
}
/*
* MBeans for VisualVM, JConsole, or JMX
*/
if (ninjaProps.getBooleanWithDefault("metrics.mbeans.enabled", true)) {
JmxReporter reporter = JmxReporter.forRegistry(metricRegistry).inDomain(applicationName).build();
reporter.start();
reporters.add(reporter);
log.debug("Started Ninja Metrics MBeans reporter");
}
log.info("Ninja Metrics is ready for collection.");
}
Aggregations