Class GarbageCollectorExports
- java.lang.Object
-
- io.prometheus.client.Collector
-
- io.prometheus.client.hotspot.GarbageCollectorExports
-
public class GarbageCollectorExports extends Collector
Exports metrics about JVM garbage collectors.Example usage:
Example metrics being exported:new GarbageCollectorExports().register();jvm_gc_collection_seconds_count{gc="PS1"} 200 jvm_gc_collection_seconds_sum{gc="PS1"} 6.7
-
-
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.util.List<java.lang.management.GarbageCollectorMXBean>garbageCollectorsprivate static java.lang.StringJVM_GC_COLLECTION_SECONDS-
Fields inherited from class io.prometheus.client.Collector
MILLISECONDS_PER_SECOND, NANOSECONDS_PER_SECOND
-
-
Constructor Summary
Constructors Constructor Description GarbageCollectorExports()GarbageCollectorExports(java.util.List<java.lang.management.GarbageCollectorMXBean> garbageCollectors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 containMetricFamilySampleswheresampleNameFilter.test(name)istruefor at least one Sample name.-
Methods inherited from class io.prometheus.client.Collector
checkMetricLabelName, checkMetricName, doubleToGoString, register, register, sanitizeMetricName
-
-
-
-
Field Detail
-
JVM_GC_COLLECTION_SECONDS
private static final java.lang.String JVM_GC_COLLECTION_SECONDS
- See Also:
- Constant Field Values
-
garbageCollectors
private final java.util.List<java.lang.management.GarbageCollectorMXBean> garbageCollectors
-
-
Method Detail
-
collect
public java.util.List<Collector.MetricFamilySamples> collect()
Description copied from class:CollectorReturn all metrics of this Collector.
-
collect
public java.util.List<Collector.MetricFamilySamples> collect(Predicate<java.lang.String> nameFilter)
Description copied from class:CollectorLikeCollector.collect(), but the result should only containMetricFamilySampleswheresampleNameFilter.test(name)istruefor at least one Sample name.The default implementation first collects all
MetricFamilySamplesand then discards the ones wheresampleNameFilter.test(name)returnsfalsefor all names inCollector.MetricFamilySamples.getNames(). To improve performance, collector implementations should override this method to preventMetricFamilySamplesfrom being collected if they will be discarded anyways. SeeThreadExportsfor an example.Note that the resulting List may contain
MetricFamilySampleswhere some Sample names returntrueforsampleNameFilter.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.
-
-