Class StandardExports
This includes stats like CPU time spent and memory usage.
Example usage:
new StandardExports().register();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class io.prometheus.client.Collector
Collector.Describable, Collector.MetricFamilySamples, Collector.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final doubleprivate final booleanprivate static final Loggerprivate final OperatingSystemMXBeanprivate final RuntimeMXBeanprivate final StandardExports.StatusReaderFields inherited from class io.prometheus.client.Collector
MILLISECONDS_PER_SECOND, NANOSECONDS_PER_SECOND -
Constructor Summary
ConstructorsConstructorDescriptionStandardExports(StandardExports.StatusReader statusReader, OperatingSystemMXBean osBean, RuntimeMXBean runtimeBean) -
Method Summary
Modifier and TypeMethodDescription(package private) static LongcallLongGetter(Method method, Object obj) Attempts to call a method either directly or via one of the implemented interfaces.(package private) static LongcallLongGetter(String getterName, Object obj) collect()Return all metrics of this Collector.(package private) voidMethods inherited from class io.prometheus.client.Collector
checkMetricLabelName, checkMetricName, collect, doubleToGoString, register, register, sanitizeMetricName
-
Field Details
-
LOGGER
-
statusReader
-
osBean
-
runtimeBean
-
linux
private final boolean linux -
KB
private static final double KB- See Also:
-
-
Constructor Details
-
StandardExports
public StandardExports() -
StandardExports
StandardExports(StandardExports.StatusReader statusReader, OperatingSystemMXBean osBean, RuntimeMXBean runtimeBean)
-
-
Method Details
-
collect
Description copied from class:CollectorReturn all metrics of this Collector. -
callLongGetter
static Long callLongGetter(String getterName, Object obj) throws NoSuchMethodException, InvocationTargetException -
callLongGetter
Attempts to call a method either directly or via one of the implemented interfaces.A Method object refers to a specific method declared in a specific class. The first invocation might happen with method == SomeConcreteClass.publicLongGetter() and will fail if SomeConcreteClass is not public. We then recurse over all interfaces implemented by SomeConcreteClass (or extended by those interfaces and so on) until we eventually invoke callMethod() with method == SomePublicInterface.publicLongGetter(), which will then succeed.
There is a built-in assumption that the method will never return null (or, equivalently, that it returns the primitive data type, i.e.
longrather thanLong). If this assumption doesn't hold, the method might be called repeatedly and the returned value will be the one produced by the last call.- Throws:
InvocationTargetException
-
collectMemoryMetricsLinux
-