Class ClassLoadingExports
- java.lang.Object
-
- io.prometheus.client.Collector
-
- io.prometheus.client.hotspot.ClassLoadingExports
-
public class ClassLoadingExports extends Collector
Exports metrics about JVM classloading.Example usage:
new ClassLoadingExports().register();
jvm_classes_currently_loaded{} 1000 jvm_classes_loaded_total{} 2000 jvm_classes_unloaded_total{} 500
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.prometheus.client.Collector
Collector.Describable, Collector.MetricFamilySamples, Collector.Type
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.management.ClassLoadingMXBean
clBean
private static java.lang.String
JVM_CLASSES_CURRENTLY_LOADED
private static java.lang.String
JVM_CLASSES_LOADED_TOTAL
private static java.lang.String
JVM_CLASSES_UNLOADED_TOTAL
-
Fields inherited from class io.prometheus.client.Collector
MILLISECONDS_PER_SECOND, NANOSECONDS_PER_SECOND
-
-
Constructor Summary
Constructors Constructor Description ClassLoadingExports()
ClassLoadingExports(java.lang.management.ClassLoadingMXBean clBean)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
addClassLoadingMetrics(java.util.List<Collector.MetricFamilySamples> sampleFamilies, Predicate<java.lang.String> nameFilter)
java.util.List<Collector.MetricFamilySamples>
collect()
Return all metrics of this Collector.java.util.List<Collector.MetricFamilySamples>
collect(Predicate<java.lang.String> nameFilter)
LikeCollector.collect()
, but the result should only containMetricFamilySamples
wheresampleNameFilter.test(name)
istrue
for at least one Sample name.-
Methods inherited from class io.prometheus.client.Collector
checkMetricLabelName, checkMetricName, doubleToGoString, register, register, sanitizeMetricName
-
-
-
-
Field Detail
-
JVM_CLASSES_CURRENTLY_LOADED
private static final java.lang.String JVM_CLASSES_CURRENTLY_LOADED
- See Also:
- Constant Field Values
-
JVM_CLASSES_LOADED_TOTAL
private static final java.lang.String JVM_CLASSES_LOADED_TOTAL
- See Also:
- Constant Field Values
-
JVM_CLASSES_UNLOADED_TOTAL
private static final java.lang.String JVM_CLASSES_UNLOADED_TOTAL
- See Also:
- Constant Field Values
-
clBean
private final java.lang.management.ClassLoadingMXBean clBean
-
-
Method Detail
-
addClassLoadingMetrics
void addClassLoadingMetrics(java.util.List<Collector.MetricFamilySamples> sampleFamilies, Predicate<java.lang.String> nameFilter)
-
collect
public java.util.List<Collector.MetricFamilySamples> collect()
Description copied from class:Collector
Return all metrics of this Collector.
-
collect
public java.util.List<Collector.MetricFamilySamples> collect(Predicate<java.lang.String> nameFilter)
Description copied from class:Collector
LikeCollector.collect()
, but the result should only containMetricFamilySamples
wheresampleNameFilter.test(name)
istrue
for at least one Sample name.The default implementation first collects all
MetricFamilySamples
and then discards the ones wheresampleNameFilter.test(name)
returnsfalse
for all names inCollector.MetricFamilySamples.getNames()
. To improve performance, collector implementations should override this method to preventMetricFamilySamples
from being collected if they will be discarded anyways. SeeThreadExports
for an example.Note that the resulting List may contain
MetricFamilySamples
where some Sample names returntrue
forsampleNameFilter.test(name)
but some Sample names returnfalse
. This is ok, because before we produce the output format we will callCollector.MetricFamilySamples.filter(Predicate)
to strip all Samples wheresampleNameFilter.test(name)
returnsfalse
.
-
-