io.prometheus.client.hotspot.MemoryPoolsExports Java Examples

The following examples show how to use io.prometheus.client.hotspot.MemoryPoolsExports. 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: PrometheusMetricsSystem.java    From besu with Apache License 2.0 6 votes vote down vote up
public static ObservableMetricsSystem init(final MetricsConfiguration metricsConfiguration) {
  if (!metricsConfiguration.isEnabled() && !metricsConfiguration.isPushEnabled()) {
    return new NoOpMetricsSystem();
  }
  final PrometheusMetricsSystem metricsSystem =
      new PrometheusMetricsSystem(
          metricsConfiguration.getMetricCategories(), metricsConfiguration.isTimersEnabled());
  if (metricsSystem.isCategoryEnabled(StandardMetricCategory.PROCESS)) {
    metricsSystem.collectors.put(
        StandardMetricCategory.PROCESS,
        singleton(new StandardExports().register(metricsSystem.registry)));
  }
  if (metricsSystem.isCategoryEnabled(StandardMetricCategory.JVM)) {
    metricsSystem.collectors.put(
        StandardMetricCategory.JVM,
        asList(
            new MemoryPoolsExports().register(metricsSystem.registry),
            new BufferPoolsExports().register(metricsSystem.registry),
            new GarbageCollectorExports().register(metricsSystem.registry),
            new ThreadExports().register(metricsSystem.registry),
            new ClassLoadingExports().register(metricsSystem.registry)));
  }
  return metricsSystem;
}
 
Example #2
Source File: WebServer.java    From hadoop-hdfs-fsimage-exporter with Apache License 2.0 6 votes vote down vote up
WebServer configure(Config config, String address, int port) throws IOException {
    // Metrics
    fsImageCollector = new FsImageCollector(config);
    fsImageCollector.register();

    new MemoryPoolsExports().register();

    final BuildInfoExporter buildInfo = new BuildInfoExporter("fsimage_exporter_",
            "fsimage_exporter").register();

    InetSocketAddress inetAddress = new InetSocketAddress(address, port);
    httpServer = new HTTPServerWithCustomHandler(inetAddress);
    httpServer.replaceRootHandler(new ConfigHttpHandler(config, buildInfo));
    LOG.info("FSImage exporter started and listening on {}", inetAddress);

    return this;
}
 
Example #3
Source File: JavaInstanceStarter.java    From pulsar with Apache License 2.0 6 votes vote down vote up
private void registerDefaultCollectors(CollectorRegistry registry) {
    // Add the JMX exporter for functionality similar to the kafka connect JMX metrics
    try {
        new JmxCollector("{}").register(registry);
    } catch (MalformedObjectNameException ex) {
        System.err.println(ex);
    }
    // Add the default exports from io.prometheus.client.hotspot.DefaultExports
    new StandardExports().register(registry);
    new MemoryPoolsExports().register(registry);
    new BufferPoolsExports().register(registry);
    new GarbageCollectorExports().register(registry);
    new ThreadExports().register(registry);
    new ClassLoadingExports().register(registry);
    new VersionInfoExports().register(registry);
}