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 double
private final boolean
private static final Logger
private final OperatingSystemMXBean
private final RuntimeMXBean
private final StandardExports.StatusReader
Fields 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 Long
callLongGetter
(Method method, Object obj) Attempts to call a method either directly or via one of the implemented interfaces.(package private) static Long
callLongGetter
(String getterName, Object obj) collect()
Return all of the metrics of this Collector.(package private) void
Methods inherited from class io.prometheus.client.Collector
checkMetricLabelName, checkMetricName, 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:Collector
Return all of the 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.
long
rather 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
-