Class MemoryPoolsExports
- java.lang.Object
-
- io.prometheus.client.Collector
-
- io.prometheus.client.hotspot.MemoryPoolsExports
-
public class MemoryPoolsExports extends Collector
Exports metrics about JVM memory areas.Example usage:
Example metrics being exported:new MemoryPoolsExports().register();jvm_memory_bytes_used{area="heap"} 2000000 jvm_memory_bytes_committed{area="nonheap"} 200000 jvm_memory_bytes_max{area="nonheap"} 2000000 jvm_memory_pool_bytes_used{pool="PS Eden Space"} 2000
-
-
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 static java.lang.StringJVM_MEMORY_BYTES_COMMITTEDprivate static java.lang.StringJVM_MEMORY_BYTES_INITprivate static java.lang.StringJVM_MEMORY_BYTES_MAXprivate static java.lang.StringJVM_MEMORY_BYTES_USEDprivate static java.lang.StringJVM_MEMORY_OBJECTS_PENDING_FINALIZATIONprivate static java.lang.StringJVM_MEMORY_POOL_BYTES_COMMITTEDprivate static java.lang.StringJVM_MEMORY_POOL_BYTES_INITprivate static java.lang.StringJVM_MEMORY_POOL_BYTES_MAXprivate static java.lang.StringJVM_MEMORY_POOL_BYTES_USEDprivate static java.lang.StringJVM_MEMORY_POOL_COLLECTION_COMMITTED_BYTESprivate static java.lang.StringJVM_MEMORY_POOL_COLLECTION_INIT_BYTESprivate static java.lang.StringJVM_MEMORY_POOL_COLLECTION_MAX_BYTESprivate static java.lang.StringJVM_MEMORY_POOL_COLLECTION_USED_BYTESprivate java.lang.management.MemoryMXBeanmemoryBeanprivate java.util.List<java.lang.management.MemoryPoolMXBean>poolBeans-
Fields inherited from class io.prometheus.client.Collector
MILLISECONDS_PER_SECOND, NANOSECONDS_PER_SECOND
-
-
Constructor Summary
Constructors Constructor Description MemoryPoolsExports()MemoryPoolsExports(java.lang.management.MemoryMXBean memoryBean, java.util.List<java.lang.management.MemoryPoolMXBean> poolBeans)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddMemoryAreaMetrics(java.util.List<Collector.MetricFamilySamples> sampleFamilies, Predicate<java.lang.String> nameFilter)(package private) voidaddMemoryPoolMetrics(java.util.List<Collector.MetricFamilySamples> sampleFamilies, Predicate<java.lang.String> nameFilter)private voidaddPoolMetrics(GaugeMetricFamily used, GaugeMetricFamily committed, GaugeMetricFamily max, GaugeMetricFamily init, java.lang.String poolName, java.lang.management.MemoryUsage poolUsage)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_MEMORY_OBJECTS_PENDING_FINALIZATION
private static final java.lang.String JVM_MEMORY_OBJECTS_PENDING_FINALIZATION
- See Also:
- Constant Field Values
-
JVM_MEMORY_BYTES_USED
private static final java.lang.String JVM_MEMORY_BYTES_USED
- See Also:
- Constant Field Values
-
JVM_MEMORY_BYTES_COMMITTED
private static final java.lang.String JVM_MEMORY_BYTES_COMMITTED
- See Also:
- Constant Field Values
-
JVM_MEMORY_BYTES_MAX
private static final java.lang.String JVM_MEMORY_BYTES_MAX
- See Also:
- Constant Field Values
-
JVM_MEMORY_BYTES_INIT
private static final java.lang.String JVM_MEMORY_BYTES_INIT
- See Also:
- Constant Field Values
-
JVM_MEMORY_POOL_BYTES_USED
private static final java.lang.String JVM_MEMORY_POOL_BYTES_USED
- See Also:
- Constant Field Values
-
JVM_MEMORY_POOL_BYTES_COMMITTED
private static final java.lang.String JVM_MEMORY_POOL_BYTES_COMMITTED
- See Also:
- Constant Field Values
-
JVM_MEMORY_POOL_BYTES_MAX
private static final java.lang.String JVM_MEMORY_POOL_BYTES_MAX
- See Also:
- Constant Field Values
-
JVM_MEMORY_POOL_BYTES_INIT
private static final java.lang.String JVM_MEMORY_POOL_BYTES_INIT
- See Also:
- Constant Field Values
-
JVM_MEMORY_POOL_COLLECTION_USED_BYTES
private static final java.lang.String JVM_MEMORY_POOL_COLLECTION_USED_BYTES
- See Also:
- Constant Field Values
-
JVM_MEMORY_POOL_COLLECTION_COMMITTED_BYTES
private static final java.lang.String JVM_MEMORY_POOL_COLLECTION_COMMITTED_BYTES
- See Also:
- Constant Field Values
-
JVM_MEMORY_POOL_COLLECTION_MAX_BYTES
private static final java.lang.String JVM_MEMORY_POOL_COLLECTION_MAX_BYTES
- See Also:
- Constant Field Values
-
JVM_MEMORY_POOL_COLLECTION_INIT_BYTES
private static final java.lang.String JVM_MEMORY_POOL_COLLECTION_INIT_BYTES
- See Also:
- Constant Field Values
-
memoryBean
private final java.lang.management.MemoryMXBean memoryBean
-
poolBeans
private final java.util.List<java.lang.management.MemoryPoolMXBean> poolBeans
-
-
Method Detail
-
addMemoryAreaMetrics
void addMemoryAreaMetrics(java.util.List<Collector.MetricFamilySamples> sampleFamilies, Predicate<java.lang.String> nameFilter)
-
addMemoryPoolMetrics
void addMemoryPoolMetrics(java.util.List<Collector.MetricFamilySamples> sampleFamilies, Predicate<java.lang.String> nameFilter)
-
addPoolMetrics
private void addPoolMetrics(GaugeMetricFamily used, GaugeMetricFamily committed, GaugeMetricFamily max, GaugeMetricFamily init, java.lang.String poolName, java.lang.management.MemoryUsage poolUsage)
-
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.
-
-