Search in sources :

Example 1 with ProcessorMetrics

use of io.micrometer.core.instrument.binder.system.ProcessorMetrics 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 ProcessorMetrics

use of io.micrometer.core.instrument.binder.system.ProcessorMetrics in project zeppelin by apache.

the class ZeppelinServer method initMetrics.

private static void initMetrics(ZeppelinConfiguration conf) {
    if (conf.isPrometheusMetricEnabled()) {
        promMetricRegistry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
        Metrics.addRegistry(promMetricRegistry);
    }
    if (conf.isJMXEnabled()) {
        Metrics.addRegistry(new JmxMeterRegistry(JmxConfig.DEFAULT, Clock.SYSTEM));
    }
    new ClassLoaderMetrics().bindTo(Metrics.globalRegistry);
    new JvmMemoryMetrics().bindTo(Metrics.globalRegistry);
    new JvmThreadMetrics().bindTo(Metrics.globalRegistry);
    new FileDescriptorMetrics().bindTo(Metrics.globalRegistry);
    new ProcessorMetrics().bindTo(Metrics.globalRegistry);
    new UptimeMetrics().bindTo(Metrics.globalRegistry);
    new JVMInfoBinder().bindTo(Metrics.globalRegistry);
}
Also used : PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry) ClassLoaderMetrics(io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics) JvmThreadMetrics(io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics) ProcessorMetrics(io.micrometer.core.instrument.binder.system.ProcessorMetrics) JmxMeterRegistry(io.micrometer.jmx.JmxMeterRegistry) FileDescriptorMetrics(io.micrometer.core.instrument.binder.system.FileDescriptorMetrics) JvmMemoryMetrics(io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics) UptimeMetrics(io.micrometer.core.instrument.binder.system.UptimeMetrics) JVMInfoBinder(org.apache.zeppelin.metric.JVMInfoBinder)

Example 3 with ProcessorMetrics

use of io.micrometer.core.instrument.binder.system.ProcessorMetrics 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)

Example 4 with ProcessorMetrics

use of io.micrometer.core.instrument.binder.system.ProcessorMetrics in project zipkin by openzipkin.

the class ZipkinPrometheusMetricsConfiguration method prometheusMeterRegistry.

@Bean
@ConditionalOnMissingBean
public PrometheusMeterRegistry prometheusMeterRegistry(PrometheusConfig config, CollectorRegistry registry, Clock clock) {
    PrometheusMeterRegistry meterRegistry = new PrometheusMeterRegistry(config, registry, clock);
    new JvmMemoryMetrics().bindTo(meterRegistry);
    new JvmGcMetrics().bindTo(meterRegistry);
    new JvmThreadMetrics().bindTo(meterRegistry);
    new ClassLoaderMetrics().bindTo(meterRegistry);
    new ProcessorMetrics().bindTo(meterRegistry);
    return meterRegistry;
}
Also used : PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry) 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) JvmGcMetrics(io.micrometer.core.instrument.binder.jvm.JvmGcMetrics) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 5 with ProcessorMetrics

use of io.micrometer.core.instrument.binder.system.ProcessorMetrics in project snow-owl by b2ihealthcare.

the class SnowOwlPlugin method createRegistry.

private PrometheusMeterRegistry createRegistry(final MonitoringConfiguration monitoringConfig) {
    final PrometheusMeterRegistry registry = new PrometheusMeterRegistry(PrometheusConfig.DEFAULT);
    Map<String, String> tags = newHashMapWithExpectedSize(1 + monitoringConfig.getTags().size());
    // always set the application tag to snow_owl
    tags.put("application", "snow_owl");
    // override with tags coming from the config file
    tags.putAll(monitoringConfig.getTags());
    // configure the tags
    final List<Tag> commonTags = tags.entrySet().stream().map(entry -> Tag.of(entry.getKey(), entry.getValue())).collect(Collectors.toList());
    registry.config().commonTags(commonTags);
    // configure default JVM and node metrics
    new ClassLoaderMetrics().bindTo(registry);
    new JvmGcMetrics().bindTo(registry);
    new JvmMemoryMetrics().bindTo(registry);
    new JvmThreadMetrics().bindTo(registry);
    new UptimeMetrics().bindTo(registry);
    new ProcessorMetrics().bindTo(registry);
    new LogbackMetrics().bindTo(registry);
    new FileDescriptorMetrics().bindTo(registry);
    return registry;
}
Also used : PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry) Index(com.b2international.index.Index) IndexSettings(com.b2international.snowowl.core.config.IndexSettings) ProcessorMetrics(io.micrometer.core.instrument.binder.system.ProcessorMetrics) ResourceTypeConverter(com.b2international.snowowl.core.ResourceTypeConverter) UptimeMetrics(io.micrometer.core.instrument.binder.system.UptimeMetrics) Plugin(com.b2international.snowowl.core.setup.Plugin) CompositeMeterRegistry(io.micrometer.core.instrument.composite.CompositeMeterRegistry) ResourceURIPathResolver(com.b2international.snowowl.core.uri.ResourceURIPathResolver) Mappings(com.b2international.index.mapping.Mappings) Indexes(com.b2international.index.Indexes) JvmGcMetrics(io.micrometer.core.instrument.binder.jvm.JvmGcMetrics) JvmMemoryMetrics(io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics) Environment(com.b2international.snowowl.core.setup.Environment) Map(java.util.Map) RevisionIndex(com.b2international.index.revision.RevisionIndex) RepositoryConfiguration(com.b2international.snowowl.core.config.RepositoryConfiguration) SnowOwlConfiguration(com.b2international.snowowl.core.config.SnowOwlConfiguration) PathTerminologyResourceResolver(com.b2international.snowowl.core.repository.PathTerminologyResourceResolver) ClassPathScanner(com.b2international.snowowl.core.plugin.ClassPathScanner) FileDescriptorMetrics(io.micrometer.core.instrument.binder.system.FileDescriptorMetrics) Tag(io.micrometer.core.instrument.Tag) DefaultRevisionIndex(com.b2international.index.revision.DefaultRevisionIndex) ClassLoaderMetrics(io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) TimestampProvider(com.b2international.index.revision.TimestampProvider) DefaultResourceURIPathResolver(com.b2international.snowowl.core.uri.DefaultResourceURIPathResolver) ConfigurationRegistry(com.b2international.snowowl.core.setup.ConfigurationRegistry) Collectors(java.util.stream.Collectors) MonitoringConfiguration(com.b2international.snowowl.core.monitoring.MonitoringConfiguration) TerminologyRegistry(com.b2international.snowowl.core.terminology.TerminologyRegistry) LogbackMetrics(io.micrometer.core.instrument.binder.logging.LogbackMetrics) List(java.util.List) VersionDocument(com.b2international.snowowl.core.version.VersionDocument) MeterRegistry(io.micrometer.core.instrument.MeterRegistry) JvmThreadMetrics(io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics) PrometheusMeterRegistry(io.micrometer.prometheus.PrometheusMeterRegistry) Maps.newHashMapWithExpectedSize(com.google.common.collect.Maps.newHashMapWithExpectedSize) Component(com.b2international.snowowl.core.plugin.Component) PrometheusConfig(io.micrometer.prometheus.PrometheusConfig) ProcessorMetrics(io.micrometer.core.instrument.binder.system.ProcessorMetrics) FileDescriptorMetrics(io.micrometer.core.instrument.binder.system.FileDescriptorMetrics) 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) Tag(io.micrometer.core.instrument.Tag) UptimeMetrics(io.micrometer.core.instrument.binder.system.UptimeMetrics) LogbackMetrics(io.micrometer.core.instrument.binder.logging.LogbackMetrics)

Aggregations

ClassLoaderMetrics (io.micrometer.core.instrument.binder.jvm.ClassLoaderMetrics)5 JvmMemoryMetrics (io.micrometer.core.instrument.binder.jvm.JvmMemoryMetrics)5 JvmThreadMetrics (io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics)5 ProcessorMetrics (io.micrometer.core.instrument.binder.system.ProcessorMetrics)5 PrometheusMeterRegistry (io.micrometer.prometheus.PrometheusMeterRegistry)5 JvmGcMetrics (io.micrometer.core.instrument.binder.jvm.JvmGcMetrics)4 MeterRegistry (io.micrometer.core.instrument.MeterRegistry)2 Tag (io.micrometer.core.instrument.Tag)2 FileDescriptorMetrics (io.micrometer.core.instrument.binder.system.FileDescriptorMetrics)2 UptimeMetrics (io.micrometer.core.instrument.binder.system.UptimeMetrics)2 Index (com.b2international.index.Index)1 Indexes (com.b2international.index.Indexes)1 Mappings (com.b2international.index.mapping.Mappings)1 DefaultRevisionIndex (com.b2international.index.revision.DefaultRevisionIndex)1 RevisionIndex (com.b2international.index.revision.RevisionIndex)1 TimestampProvider (com.b2international.index.revision.TimestampProvider)1 ResourceTypeConverter (com.b2international.snowowl.core.ResourceTypeConverter)1 IndexSettings (com.b2international.snowowl.core.config.IndexSettings)1 RepositoryConfiguration (com.b2international.snowowl.core.config.RepositoryConfiguration)1 SnowOwlConfiguration (com.b2international.snowowl.core.config.SnowOwlConfiguration)1