Search in sources :

Example 6 with FileDescriptorRatioGauge

use of com.codahale.metrics.jvm.FileDescriptorRatioGauge in project stdlib by petergeneric.

the class CoreMetricsModule method buildRegistry.

public static MetricRegistry buildRegistry() {
    MetricRegistry registry = new MetricRegistry();
    registry.register(MetricRegistry.name("jvm", "gc"), new GarbageCollectorMetricSet());
    registry.register(MetricRegistry.name("jvm", "memory"), new MemoryUsageGaugeSet());
    registry.register(MetricRegistry.name("jvm", "thread-states"), new ThreadStatesGaugeSet());
    registry.register(MetricRegistry.name("jvm", "fd", "usage"), new FileDescriptorRatioGauge());
    return registry;
}
Also used : FileDescriptorRatioGauge(com.codahale.metrics.jvm.FileDescriptorRatioGauge) MemoryUsageGaugeSet(com.codahale.metrics.jvm.MemoryUsageGaugeSet) MetricRegistry(com.codahale.metrics.MetricRegistry) ThreadStatesGaugeSet(com.codahale.metrics.jvm.ThreadStatesGaugeSet) GarbageCollectorMetricSet(com.codahale.metrics.jvm.GarbageCollectorMetricSet)

Example 7 with FileDescriptorRatioGauge

use of com.codahale.metrics.jvm.FileDescriptorRatioGauge in project be5 by DevelopmentOnTheEdge.

the class MetricsModule method configureServlets.

@Override
protected void configureServlets() {
    bind(AdminServlet.class).asEagerSingleton();
    serve("/api/metrics/admin*").with(AdminServlet.class);
    bind(MetricsServlet.class).asEagerSingleton();
    serve("/metrics*").with(MetricsServlet.class);
    bind(MetricsUIServlet.class).asEagerSingleton();
    serve("/api/metrics/ui*").with(MetricsUIServlet.class);
    filter("/*").through(new InstrumentedFilter());
    Metrics.HEALTH_CHECKS.register("db", new DatabaseHealthCheck());
    METRIC_REGISTRY.register(PROP_METRIC_REG_JVM_MEMORY, new MemoryUsageGaugeSet());
    METRIC_REGISTRY.register(PROP_METRIC_REG_JVM_GARBAGE, new GarbageCollectorMetricSet());
    METRIC_REGISTRY.register(PROP_METRIC_REG_JVM_THREADS, new ThreadStatesGaugeSet());
    METRIC_REGISTRY.register(PROP_METRIC_REG_JVM_FILES, new FileDescriptorRatioGauge());
    METRIC_REGISTRY.register(PROP_METRIC_REG_JVM_ATTRIBUTE, new JvmAttributeGaugeSet());
    METRIC_REGISTRY.register(PROP_METRIC_REG_JVM_CLASSLOADER, new ClassLoadingGaugeSet());
    METRIC_REGISTRY.register(PROP_METRIC_REG_JVM_BUFFERS, new BufferPoolMetricSet(ManagementFactory.getPlatformMBeanServer()));
    final LoggerContext factory = (LoggerContext) LoggerFactory.getILoggerFactory();
    final Logger root = factory.getLogger(Logger.ROOT_LOGGER_NAME);
    final InstrumentedAppender metrics = new InstrumentedAppender(METRIC_REGISTRY);
    metrics.setContext(root.getLoggerContext());
    metrics.start();
    root.addAppender(metrics);
// final JmxReporter reporter = JmxReporter.forRegistry(METRIC_REGISTRY).build();
// reporter.start();
// String hostName = "192.168.66.29";
// ZabbixSender zabbixSender = new ZabbixSender("https://zabbix.dote.ru/", 10051);
// ZabbixReporter zabbixReporter = ZabbixReporter.forRegistry(METRIC_REGISTRY)
// //.hostName(hostName)
// .prefix("testBe5app.")
// .build(zabbixSender);
// 
// zabbixReporter.start(5, TimeUnit.SECONDS);
}
Also used : BufferPoolMetricSet(com.codahale.metrics.jvm.BufferPoolMetricSet) InstrumentedAppender(com.codahale.metrics.logback.InstrumentedAppender) FileDescriptorRatioGauge(com.codahale.metrics.jvm.FileDescriptorRatioGauge) ClassLoadingGaugeSet(com.codahale.metrics.jvm.ClassLoadingGaugeSet) Logger(ch.qos.logback.classic.Logger) LoggerContext(ch.qos.logback.classic.LoggerContext) InstrumentedFilter(com.codahale.metrics.servlet.InstrumentedFilter) MetricsUIServlet(org.marmelo.dropwizard.metrics.servlets.MetricsUIServlet) JvmAttributeGaugeSet(com.codahale.metrics.jvm.JvmAttributeGaugeSet) AdminServlet(com.codahale.metrics.servlets.AdminServlet) MemoryUsageGaugeSet(com.codahale.metrics.jvm.MemoryUsageGaugeSet) MetricsServlet(com.codahale.metrics.servlets.MetricsServlet) ThreadStatesGaugeSet(com.codahale.metrics.jvm.ThreadStatesGaugeSet) GarbageCollectorMetricSet(com.codahale.metrics.jvm.GarbageCollectorMetricSet)

Example 8 with FileDescriptorRatioGauge

use of com.codahale.metrics.jvm.FileDescriptorRatioGauge in project stdlib by petergeneric.

the class CoreMetricsModule method buildRegistry.

public static MetricRegistry buildRegistry(final boolean includeJvm) {
    MetricRegistry registry = new MetricRegistry();
    if (includeJvm) {
        registry.register(MetricRegistry.name("jvm", "gc"), new GarbageCollectorMetricSet());
        registry.register(MetricRegistry.name("jvm", "memory"), new MemoryUsageGaugeSet());
        registry.register(MetricRegistry.name("jvm", "thread-states"), new ThreadStatesGaugeSet());
        registry.register(MetricRegistry.name("jvm", "fd", "usage"), new FileDescriptorRatioGauge());
    }
    return registry;
}
Also used : FileDescriptorRatioGauge(com.codahale.metrics.jvm.FileDescriptorRatioGauge) MemoryUsageGaugeSet(com.codahale.metrics.jvm.MemoryUsageGaugeSet) MetricRegistry(com.codahale.metrics.MetricRegistry) ThreadStatesGaugeSet(com.codahale.metrics.jvm.ThreadStatesGaugeSet) GarbageCollectorMetricSet(com.codahale.metrics.jvm.GarbageCollectorMetricSet)

Example 9 with FileDescriptorRatioGauge

use of com.codahale.metrics.jvm.FileDescriptorRatioGauge in project chassis by Kixeye.

the class MetricsConfiguration method metricRegistry.

/**
 * Initializes the metrics registry
 *
 * @return metric registry bean
 */
@Bean
public MetricRegistry metricRegistry() {
    final MetricRegistry bean = new MetricRegistry();
    // add JVM metrics
    bean.register("jvm.gc", new GarbageCollectorMetricSet());
    bean.register("jvm.memory", new MemoryUsageGaugeSet());
    bean.register("jvm.thread-states", new ThreadStatesGaugeSet());
    bean.register("jvm.fd", new FileDescriptorRatioGauge());
    return bean;
}
Also used : FileDescriptorRatioGauge(com.codahale.metrics.jvm.FileDescriptorRatioGauge) MemoryUsageGaugeSet(com.codahale.metrics.jvm.MemoryUsageGaugeSet) MetricRegistry(com.codahale.metrics.MetricRegistry) ThreadStatesGaugeSet(com.codahale.metrics.jvm.ThreadStatesGaugeSet) GarbageCollectorMetricSet(com.codahale.metrics.jvm.GarbageCollectorMetricSet) Bean(org.springframework.context.annotation.Bean)

Example 10 with FileDescriptorRatioGauge

use of com.codahale.metrics.jvm.FileDescriptorRatioGauge in project cas by apereo.

the class CasMetricsConfiguration method metrics.

/**
 * Metric registry metric registry.
 *
 * @return the metric registry
 */
@RefreshScope
@Bean
public MetricRegistry metrics() {
    final MetricRegistry metrics = new MetricRegistry();
    metrics.register("jvm.gc", new GarbageCollectorMetricSet());
    metrics.register("jvm.memory", new MemoryUsageGaugeSet());
    metrics.register("thread-states", new ThreadStatesGaugeSet());
    metrics.register("jvm.fd.usage", new FileDescriptorRatioGauge());
    return metrics;
}
Also used : FileDescriptorRatioGauge(com.codahale.metrics.jvm.FileDescriptorRatioGauge) MemoryUsageGaugeSet(com.codahale.metrics.jvm.MemoryUsageGaugeSet) MetricRegistry(com.codahale.metrics.MetricRegistry) ThreadStatesGaugeSet(com.codahale.metrics.jvm.ThreadStatesGaugeSet) GarbageCollectorMetricSet(com.codahale.metrics.jvm.GarbageCollectorMetricSet) RefreshScope(org.springframework.cloud.context.config.annotation.RefreshScope) Bean(org.springframework.context.annotation.Bean)

Aggregations

FileDescriptorRatioGauge (com.codahale.metrics.jvm.FileDescriptorRatioGauge)15 GarbageCollectorMetricSet (com.codahale.metrics.jvm.GarbageCollectorMetricSet)14 MemoryUsageGaugeSet (com.codahale.metrics.jvm.MemoryUsageGaugeSet)14 ThreadStatesGaugeSet (com.codahale.metrics.jvm.ThreadStatesGaugeSet)11 BufferPoolMetricSet (com.codahale.metrics.jvm.BufferPoolMetricSet)7 MetricRegistry (com.codahale.metrics.MetricRegistry)6 ClassLoadingGaugeSet (com.codahale.metrics.jvm.ClassLoadingGaugeSet)4 Bean (org.springframework.context.annotation.Bean)3 Logger (ch.qos.logback.classic.Logger)2 LoggerContext (ch.qos.logback.classic.LoggerContext)2 JvmAttributeGaugeSet (com.codahale.metrics.jvm.JvmAttributeGaugeSet)2 InstrumentedAppender (com.codahale.metrics.logback.InstrumentedAppender)2 PostConstruct (javax.annotation.PostConstruct)2 JmxReporter (com.codahale.metrics.JmxReporter)1 MetricSet (com.codahale.metrics.MetricSet)1 CachedThreadStatesGaugeSet (com.codahale.metrics.jvm.CachedThreadStatesGaugeSet)1 ThreadDeadlockDetector (com.codahale.metrics.jvm.ThreadDeadlockDetector)1 InstrumentedFilter (com.codahale.metrics.servlet.InstrumentedFilter)1 AdminServlet (com.codahale.metrics.servlets.AdminServlet)1 MetricsServlet (com.codahale.metrics.servlets.MetricsServlet)1