Module org.elasticsearch.server
Class DesiredBalanceMetrics
java.lang.Object
org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalanceMetrics
Maintains balancer metrics and makes them accessible to the
MeterRegistry and APM reporting. Metrics are updated
(updateMetrics(org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalanceMetrics.AllocationStats, java.util.Map<org.elasticsearch.cluster.node.DiscoveryNode, org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalanceMetrics.NodeWeightStats>, java.util.Map<org.elasticsearch.cluster.node.DiscoveryNode, org.elasticsearch.cluster.routing.allocation.NodeAllocationStatsAndWeightsCalculator.NodeAllocationStatsAndWeight>)) or cleared (zeroAllMetrics()) as a result of cluster events and the metrics will be pulled for reporting
via the MeterRegistry implementation. Only the master node reports metrics: see setNodeIsMaster(boolean). When
nodeIsMaster is false, empty values are returned such that MeterRegistry ignores the metrics for reporting purposes.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final DesiredBalanceMetrics.AllocationStatsstatic final StringSeetotalAllocationsstatic final StringSeeunassignedShardsstatic final StringSeeundesiredAllocationsExcludingShuttingDownNodesstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetNodeIsMaster(boolean nodeIsMaster) WhennodeIsMasteris set to true, the server will report APM metrics registered in this file.longlonglongvoidupdateMetrics(DesiredBalanceMetrics.AllocationStats allocationStats, Map<DiscoveryNode, DesiredBalanceMetrics.NodeWeightStats> weightStatsPerNode, Map<DiscoveryNode, NodeAllocationStatsAndWeightsCalculator.NodeAllocationStatsAndWeight> nodeAllocationStats) voidSets all the internal class fields to zero/empty.
-
Field Details
-
UNASSIGNED_SHARDS_METRIC_NAME
SeeunassignedShards- See Also:
-
TOTAL_SHARDS_METRIC_NAME
SeetotalAllocations- See Also:
-
UNDESIRED_ALLOCATION_COUNT_METRIC_NAME
SeeundesiredAllocationsExcludingShuttingDownNodes- See Also:
-
UNDESIRED_ALLOCATION_RATIO_METRIC_NAME
- See Also:
-
DESIRED_BALANCE_NODE_WEIGHT_METRIC_NAME
- See Also:
-
DESIRED_BALANCE_NODE_SHARD_COUNT_METRIC_NAME
- See Also:
-
DESIRED_BALANCE_NODE_WRITE_LOAD_METRIC_NAME
- See Also:
-
DESIRED_BALANCE_NODE_DISK_USAGE_METRIC_NAME
- See Also:
-
CURRENT_NODE_WEIGHT_METRIC_NAME
- See Also:
-
CURRENT_NODE_SHARD_COUNT_METRIC_NAME
- See Also:
-
CURRENT_NODE_WRITE_LOAD_METRIC_NAME
- See Also:
-
CURRENT_NODE_DISK_USAGE_METRIC_NAME
- See Also:
-
CURRENT_NODE_UNDESIRED_SHARD_COUNT_METRIC_NAME
- See Also:
-
CURRENT_NODE_FORECASTED_DISK_USAGE_METRIC_NAME
- See Also:
-
EMPTY_ALLOCATION_STATS
-
-
Constructor Details
-
DesiredBalanceMetrics
-
-
Method Details
-
updateMetrics
public void updateMetrics(DesiredBalanceMetrics.AllocationStats allocationStats, Map<DiscoveryNode, DesiredBalanceMetrics.NodeWeightStats> weightStatsPerNode, Map<DiscoveryNode, NodeAllocationStatsAndWeightsCalculator.NodeAllocationStatsAndWeight> nodeAllocationStats) -
setNodeIsMaster
public void setNodeIsMaster(boolean nodeIsMaster) WhennodeIsMasteris set to true, the server will report APM metrics registered in this file. When set to false, empty values will be returned such that no APM metrics are sent from this server. -
unassignedShards
public long unassignedShards() -
totalAllocations
public long totalAllocations() -
undesiredAllocations
public long undesiredAllocations() -
zeroAllMetrics
public void zeroAllMetrics()Sets all the internal class fields to zero/empty. Typically used in conjunction withsetNodeIsMaster(boolean). This is best-effort because it is possible forupdateMetrics(org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalanceMetrics.AllocationStats, java.util.Map<org.elasticsearch.cluster.node.DiscoveryNode, org.elasticsearch.cluster.routing.allocation.allocator.DesiredBalanceMetrics.NodeWeightStats>, java.util.Map<org.elasticsearch.cluster.node.DiscoveryNode, org.elasticsearch.cluster.routing.allocation.NodeAllocationStatsAndWeightsCalculator.NodeAllocationStatsAndWeight>)to race with this method.
-