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