io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics Java Examples

The following examples show how to use io.micrometer.core.instrument.binder.jvm.JvmThreadMetrics. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CentralDogma.java    From centraldogma with Apache License 2.0 7 votes vote down vote up
private void configureMetrics(ServerBuilder sb, PrometheusMeterRegistry registry) {
    sb.meterRegistry(registry);
    sb.service(METRICS_PATH, new PrometheusExpositionService(registry.getPrometheusRegistry()));
    sb.decorator(MetricCollectingService.newDecorator(MeterIdPrefixFunction.ofDefault("api")));

    // Bind system metrics.
    new FileDescriptorMetrics().bindTo(registry);
    new ProcessorMetrics().bindTo(registry);
    new ClassLoaderMetrics().bindTo(registry);
    new UptimeMetrics().bindTo(registry);
    new DiskSpaceMetrics(cfg.dataDir()).bindTo(registry);
    new JvmGcMetrics().bindTo(registry);
    new JvmMemoryMetrics().bindTo(registry);
    new JvmThreadMetrics().bindTo(registry);

    // Bind global thread pool metrics.
    ExecutorServiceMetrics.monitor(registry, ForkJoinPool.commonPool(), "commonPool");
}
 
Example #2
Source File: MetricsManager.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
public MetricsManager(String brokerName,
                      MetricsConfiguration metricsConfiguration,
                      HierarchicalRepository<AddressSettings> addressSettingsRepository) {
   this.brokerName = brokerName;
   meterRegistry = metricsConfiguration.getPlugin().getRegistry();
   Metrics.globalRegistry.add(meterRegistry);
   this.addressSettingsRepository = addressSettingsRepository;
   if (metricsConfiguration.isJvmMemory()) {
      new JvmMemoryMetrics().bindTo(meterRegistry);
   }
   if (metricsConfiguration.isJvmGc()) {
      new JvmGcMetrics().bindTo(meterRegistry);
   }
   if (metricsConfiguration.isJvmThread()) {
      new JvmThreadMetrics().bindTo(meterRegistry);
   }
}
 
Example #3
Source File: MicrometerMetricsExamples.java    From vertx-micrometer-metrics with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #4
Source File: MetricsRegistry.java    From mewbase with MIT License 5 votes vote down vote up
static void ensureRegistry() {

        if ( globalRegistry.getRegistries().isEmpty() ) addRegistry(new SimpleMeterRegistry());

        new ClassLoaderMetrics().bindTo(globalRegistry);
        new JvmMemoryMetrics().bindTo(globalRegistry);
        new JvmGcMetrics().bindTo(globalRegistry);
        new ProcessorMetrics().bindTo(globalRegistry);
        new JvmThreadMetrics().bindTo(globalRegistry);

    }
 
Example #5
Source File: StatsProviderImpl.java    From pravega with Apache License 2.0 5 votes vote down vote up
@Synchronized
private void init() {
    new JvmMemoryMetrics().bindTo(metrics);
    new JvmGcMetrics().bindTo(metrics);
    new ProcessorMetrics().bindTo(metrics);
    new JvmThreadMetrics().bindTo(metrics);
}
 
Example #6
Source File: JvmMetricsConfig.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Autowired
public void bindToRegistry( MeterRegistry registry, JvmGcMetrics jvmGcMetrics, JvmMemoryMetrics jvmMemoryMetrics,
    JvmThreadMetrics jvmThreadMetrics, ClassLoaderMetrics classLoaderMetrics )
{
    jvmGcMetrics.bindTo( registry );
    jvmMemoryMetrics.bindTo( registry );
    jvmThreadMetrics.bindTo( registry );
    classLoaderMetrics.bindTo( registry );
}
 
Example #7
Source File: MetricsModule.java    From che with Eclipse Public License 2.0 5 votes vote down vote up
@Override
protected void configure() {
  bind(MetricsServer.class).asEagerSingleton();
  bind(MetricsBinder.class).asEagerSingleton();
  bind(CollectorRegistry.class).toInstance(CollectorRegistry.defaultRegistry);
  bind(PrometheusMeterRegistry.class)
      .toProvider(PrometheusMeterRegistryProvider.class)
      .asEagerSingleton();
  bind(MeterRegistry.class).to(PrometheusMeterRegistry.class);

  Multibinder<MeterBinder> meterMultibinder =
      Multibinder.newSetBinder(binder(), MeterBinder.class);
  meterMultibinder.addBinding().to(ClassLoaderMetrics.class);
  meterMultibinder.addBinding().to(JvmMemoryMetrics.class);
  meterMultibinder.addBinding().to(JvmGcMetrics.class);
  meterMultibinder.addBinding().to(JvmThreadMetrics.class);
  meterMultibinder.addBinding().to(LogbackMetrics.class);
  meterMultibinder.addBinding().to(FileDescriptorMetrics.class);
  meterMultibinder.addBinding().to(ProcessorMetrics.class);
  meterMultibinder.addBinding().to(UptimeMetrics.class);
  meterMultibinder.addBinding().to(FileStoresMeterBinder.class);
  meterMultibinder.addBinding().to(ApiResponseCounter.class);
  meterMultibinder.addBinding().to(ProcessMemoryMetrics.class);
  meterMultibinder.addBinding().to(ProcessThreadMetrics.class);

  bind(EventListener.class).toProvider(OkHttpMetricsEventListenerProvider.class);
}
 
Example #8
Source File: MetricsModule.java    From dolphin-platform with Apache License 2.0 5 votes vote down vote up
@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);
    }
}
 
Example #9
Source File: JVMAutoConfiguration.java    From summerframework with Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnMissingBean
public JvmThreadMetrics jvmThreadMetrics(PlatformTag platformTag) {
    return new JvmThreadMetrics(platformTag.getTags());
}
 
Example #10
Source File: MonitoringConfiguration.java    From Spring-Boot-2.0-Cookbook-Second-Edition with MIT License 4 votes vote down vote up
@Bean
public JvmThreadMetrics jvmThreadMetrics() {
    return new JvmThreadMetrics();
}
 
Example #11
Source File: MonitoringConfiguration.java    From Spring-Boot-2.0-Cookbook-Second-Edition with MIT License 4 votes vote down vote up
@Bean
public JvmThreadMetrics jvmThreadMetrics() {
    return new JvmThreadMetrics();
}
 
Example #12
Source File: MonitoringConfiguration.java    From Spring-Boot-2.0-Cookbook-Second-Edition with MIT License 4 votes vote down vote up
@Bean
public JvmThreadMetrics jvmThreadMetrics() {
    return new JvmThreadMetrics();
}
 
Example #13
Source File: MetricsAutoConfiguration.java    From foremast with Apache License 2.0 4 votes vote down vote up
@Bean
public JvmThreadMetrics jvmThreadMetrics() {
    return new JvmThreadMetrics();
}
 
Example #14
Source File: JvmMetricsConfig.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Bean
public JvmThreadMetrics jvmThreadMetrics()
{
    return new JvmThreadMetrics();
}
 
Example #15
Source File: ArmeriaSpringBoot1MeterBindersConfiguration.java    From armeria with Apache License 2.0 4 votes vote down vote up
/**
 * Returns {@link JvmThreadMetrics}.
 */
@Bean
@ConditionalOnMissingBean(JvmThreadMetrics.class)
public JvmThreadMetrics threadMetrics() {
    return new JvmThreadMetrics();
}
 
Example #16
Source File: MeterBindersConfiguration.java    From molgenis with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Bean
public JvmThreadMetrics jvmThreadMetrics() {
  return new JvmThreadMetrics();
}