类io.prometheus.client.hotspot.StandardExports源码实例Demo

下面列出了怎么用io.prometheus.client.hotspot.StandardExports的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: besu   文件: PrometheusMetricsSystem.java
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;
}
 
源代码2 项目: pulsar   文件: JavaInstanceStarter.java
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);
}