Class CounterWithCallback

All Implemented Interfaces:
io.prometheus.metrics.model.registry.Collector

@StableApi public class CounterWithCallback extends MetricWithFixedMetadata
Example:

 ClassLoadingMXBean classLoadingMXBean = ManagementFactory.getClassLoadingMXBean();

 CounterWithCallback.builder()
         .name("classes_loaded_total")
         .help("The total number of classes since the JVM has started execution")
         .callback(callback -> callback.call(classLoadingMXBean.getLoadedClassCount()))
         .register();
 
  • Method Details