Class BufferPoolsExports


  • public class BufferPoolsExports
    extends Collector
    Exports metrics about JVM buffers. Can be replaced with a simple access once JDK 1.7 compatibility is baseline.
    • Field Detail

      • JVM_BUFFER_POOL_USED_BYTES

        private static final java.lang.String JVM_BUFFER_POOL_USED_BYTES
        See Also:
        Constant Field Values
      • JVM_BUFFER_POOL_CAPACITY_BYTES

        private static final java.lang.String JVM_BUFFER_POOL_CAPACITY_BYTES
        See Also:
        Constant Field Values
      • JVM_BUFFER_POOL_USED_BUFFERS

        private static final java.lang.String JVM_BUFFER_POOL_USED_BUFFERS
        See Also:
        Constant Field Values
      • LOGGER

        private static final java.util.logging.Logger LOGGER
      • bufferPoolMXBeans

        private final java.util.List<java.lang.Object> bufferPoolMXBeans
      • getName

        private java.lang.reflect.Method getName
      • getMemoryUsed

        private java.lang.reflect.Method getMemoryUsed
      • getTotalCapacity

        private java.lang.reflect.Method getTotalCapacity
      • getCount

        private java.lang.reflect.Method getCount
    • Constructor Detail

      • BufferPoolsExports

        public BufferPoolsExports()
    • Method Detail

      • accessBufferPoolMXBeans

        private static java.util.List<java.lang.Object> accessBufferPoolMXBeans​(java.lang.Class<?> bufferPoolMXBeanClass)
      • collect

        public java.util.List<Collector.MetricFamilySamples> collect​(Predicate<java.lang.String> nameFilter)
        Description copied from class: Collector
        Like Collector.collect(), but the result should only contain MetricFamilySamples where sampleNameFilter.test(name) is true for at least one Sample name.

        The default implementation first collects all MetricFamilySamples and then discards the ones where sampleNameFilter.test(name) returns false for all names in Collector.MetricFamilySamples.getNames(). To improve performance, collector implementations should override this method to prevent MetricFamilySamples from being collected if they will be discarded anyways. See ThreadExports for an example.

        Note that the resulting List may contain MetricFamilySamples where some Sample names return true for sampleNameFilter.test(name) but some Sample names return false. This is ok, because before we produce the output format we will call Collector.MetricFamilySamples.filter(Predicate) to strip all Samples where sampleNameFilter.test(name) returns false.

        Overrides:
        collect in class Collector
        Parameters:
        nameFilter - may be null, indicating that all metrics should be collected.
      • callLongMethod

        private long callLongMethod​(java.lang.reflect.Method method,
                                    java.lang.Object pool)
      • getName

        private java.lang.String getName​(java.lang.Object pool)