Package org.opensearch.node
Class ResourceUsageCollectorService
java.lang.Object
org.opensearch.common.lifecycle.AbstractLifecycleComponent
org.opensearch.node.ResourceUsageCollectorService
- All Implemented Interfaces:
Closeable
,AutoCloseable
,ClusterStateListener
,org.opensearch.common.lease.Releasable
,org.opensearch.common.lifecycle.LifecycleComponent
public class ResourceUsageCollectorService
extends org.opensearch.common.lifecycle.AbstractLifecycleComponent
implements ClusterStateListener
This collects node level resource usage statistics such as cpu, memory, IO of each node and makes it available for
coordinator node to aid in throttling, ranking etc
-
Field Summary
Fields inherited from class org.opensearch.common.lifecycle.AbstractLifecycleComponent
lifecycle
-
Constructor Summary
ConstructorDescriptionResourceUsageCollectorService
(NodeResourceUsageTracker nodeResourceUsageTracker, ClusterService clusterService, ThreadPool threadPool) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Called when cluster state changes.void
collectNodeResourceUsageStats
(String nodeId, long timestamp, double memoryUtilizationPercent, double cpuUtilizationPercent, IoUsageStats ioUsageStats) Collect node resource usage stats along with the timestampprotected void
doClose()
protected void
doStart()
protected void
doStop()
Get all node resource usage statistics which will be used for node statsgetNodeStatistics
(String nodeId) Optionally return aNodeResourceUsageStats
for the given nodeid, if resource usage stats information exists for the given node.stats()
Returns collected resource usage statistics of all nodesMethods inherited from class org.opensearch.common.lifecycle.AbstractLifecycleComponent
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
-
Constructor Details
-
ResourceUsageCollectorService
public ResourceUsageCollectorService(NodeResourceUsageTracker nodeResourceUsageTracker, ClusterService clusterService, ThreadPool threadPool)
-
-
Method Details
-
clusterChanged
Description copied from interface:ClusterStateListener
Called when cluster state changes.- Specified by:
clusterChanged
in interfaceClusterStateListener
-
collectNodeResourceUsageStats
public void collectNodeResourceUsageStats(String nodeId, long timestamp, double memoryUtilizationPercent, double cpuUtilizationPercent, IoUsageStats ioUsageStats) Collect node resource usage stats along with the timestamp -
getAllNodeStatistics
Get all node resource usage statistics which will be used for node stats -
getNodeStatistics
Optionally return aNodeResourceUsageStats
for the given nodeid, if resource usage stats information exists for the given node. Returns an emptyOptional
if the node was not found. -
stats
Returns collected resource usage statistics of all nodes -
doStart
protected void doStart()- Specified by:
doStart
in classorg.opensearch.common.lifecycle.AbstractLifecycleComponent
-
doStop
protected void doStop()- Specified by:
doStop
in classorg.opensearch.common.lifecycle.AbstractLifecycleComponent
-
doClose
protected void doClose()- Specified by:
doClose
in classorg.opensearch.common.lifecycle.AbstractLifecycleComponent
-