Search in sources :

Example 1 with JvmMemoryMetrics

use of io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics in project dolphin-platform by canoo.

the class MetricsModule method initialize.

@Override
public void initialize(final ServerCoreComponents coreComponents) {
    final PlatformConfiguration configuration = coreComponents.getConfiguration();
    final ServletContext servletContext = coreComponents.getInstance(ServletContext.class);
    if (!configuration.getBooleanProperty(METRICS_NOOP_PROPERTY, true)) {
        final PrometheusMeterRegistry prometheusRegistry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
        final List<Tag> tagList = TagUtil.convertTags(ContextManagerImpl.getInstance().getGlobalContexts());
        new ClassLoaderMetrics(tagList).bindTo(prometheusRegistry);
        new JvmMemoryMetrics(tagList).bindTo(prometheusRegistry);
        new JvmGcMetrics(tagList).bindTo(prometheusRegistry);
        new ProcessorMetrics(tagList).bindTo(prometheusRegistry);
        new JvmThreadMetrics(tagList).bindTo(prometheusRegistry);
        servletContext.addFilter(METRICS_SERVLET_FILTER_NAME, new RequestMetricsFilter()).addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, ALL_URL_MAPPING);
        servletContext.addListener(new MetricsHttpSessionListener());
        servletContext.addServlet(METRICS_SERVLET_NAME, new MetricsServlet(prometheusRegistry)).addMapping(configuration.getProperty(METRICS_ENDPOINT_PROPERTY));
        MetricsImpl.getInstance().init(prometheusRegistry);
    }
}
Also used : PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry) PlatformConfiguration(com.canoo.platform.core.PlatformConfiguration) ProcessorMetrics(io.micrometer.core.instrument.binder.system.ProcessorMetrics) RequestMetricsFilter(com.canoo.dp.impl.platform.server.metrics.servlet.RequestMetricsFilter) JvmMemoryMetrics(io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics) JvmGcMetrics(io.micrometer.core.instrument.binder.jvm.JvmGcMetrics) ClassLoaderMetrics(io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics) JvmThreadMetrics(io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics) MetricsHttpSessionListener(com.canoo.dp.impl.platform.server.metrics.servlet.MetricsHttpSessionListener) MetricsServlet(com.canoo.dp.impl.platform.server.metrics.servlet.MetricsServlet) ServletContext(javax.servlet.ServletContext) Tag(io.micrometer.core.instrument.Tag) DispatcherType(javax.servlet.DispatcherType)

Example 2 with JvmMemoryMetrics

use of io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics in project vertx-micrometer-metrics by vert-x3.

the class MetricsExamples method instrumentJVM.

public void instrumentJVM() {
    MeterRegistry registry = BackendRegistries.getDefaultNow();
    new ClassLoaderMetrics().bindTo(registry);
    new JvmMemoryMetrics().bindTo(registry);
    new JvmGcMetrics().bindTo(registry);
    new ProcessorMetrics().bindTo(registry);
    new JvmThreadMetrics().bindTo(registry);
}
Also used : ClassLoaderMetrics(io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics) JvmThreadMetrics(io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics) ProcessorMetrics(io.micrometer.core.instrument.binder.system.ProcessorMetrics) JvmMemoryMetrics(io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics) MeterRegistry(io.micrometer.core.instrument.MeterRegistry) PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry) JvmGcMetrics(io.micrometer.core.instrument.binder.jvm.JvmGcMetrics)

Aggregations

ClassLoaderMetrics (io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics)2 JvmGcMetrics (io.micrometer.core.instrument.binder.jvm.JvmGcMetrics)2 JvmMemoryMetrics (io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics)2 JvmThreadMetrics (io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics)2 ProcessorMetrics (io.micrometer.core.instrument.binder.system.ProcessorMetrics)2 PrometheusMeterRegistry (io.micrometer.prometheus.PrometheusMeterRegistry)2 MetricsHttpSessionListener (com.canoo.dp.impl.platform.server.metrics.servlet.MetricsHttpSessionListener)1 MetricsServlet (com.canoo.dp.impl.platform.server.metrics.servlet.MetricsServlet)1 RequestMetricsFilter (com.canoo.dp.impl.platform.server.metrics.servlet.RequestMetricsFilter)1 PlatformConfiguration (com.canoo.platform.core.PlatformConfiguration)1 MeterRegistry (io.micrometer.core.instrument.MeterRegistry)1 Tag (io.micrometer.core.instrument.Tag)1 DispatcherType (javax.servlet.DispatcherType)1 ServletContext (javax.servlet.ServletContext)1