Class CpuCollector
java.lang.Object
io.fluxzero.sdk.tracking.metrics.host.collectors.CpuCollector
- All Implemented Interfaces:
MetricCollector<CpuMetrics>
Collector for CPU metrics using JMX.
Uses the com.sun.management extension when available for detailed CPU metrics.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncollect()Collects metrics.booleanChecks if this collector is available on the current platform.
-
Constructor Details
-
CpuCollector
public CpuCollector()
-
-
Method Details
-
collect
Description copied from interface:MetricCollectorCollects metrics.- Specified by:
collectin interfaceMetricCollector<CpuMetrics>- Returns:
- an Optional containing the collected metrics, or empty if collection failed or the metrics are not available on this platform
-
isAvailable
public boolean isAvailable()Description copied from interface:MetricCollectorChecks if this collector is available on the current platform.This method should return quickly and may cache its result.
- Specified by:
isAvailablein interfaceMetricCollector<CpuMetrics>- Returns:
- true if this collector can collect metrics on the current platform
-