DesiredBalance: expose it via _internal/desired_balance (#91038)
Add an internal endpoint for exposed the desired balance and computation stats at a master node as GET _internal/desired_balance and returns
```
{
"stats": {
"computation_active": false,
"computation_submitted": 5,
"computation_executed": 5,
"computation_converged": 5,
"computation_iterations": 4,
"computation_converged_index": 4,
"computation_time_in_millis": 0,
"reconciliation_time_in_millis": 0
},
"routing_table": {
"test": {
"0": {
"current": [
{
"state": "STARTED",
"primary": true,
"node": "UPYt8VwWTt-IADAEbqpLxA",
"node_is_desired": true,
"relocating_node": null,
"relocating_node_is_desired": false,
"shard_id": 0,
"index": "test"
}
],
"desired": {
"node_ids": [
"UPYt8VwWTt-IADAEbqpLxA"
],
"total": 1,
"unassigned": 0,
"ignored": 0
}
},
"1": {
"current": [
{
"state": "STARTED",
"primary": true,
"node": "2x1VTuSOQdeguXPdN73yRw",
"node_is_desired": true,
"relocating_node": null,
"relocating_node_is_desired": false,
"shard_id": 1,
"index": "test"
}
],
"desired": {
"node_ids": [
"2x1VTuSOQdeguXPdN73yRw"
],
"total": 1,
"unassigned": 0,
"ignored": 0
}
}
}
}
}
```
Fixes #90583
2022-11-16 09:54:10 +08:00
|
|
|
[[get-desired-balance]]
|
|
|
|
=== Get desired balance API
|
|
|
|
++++
|
|
|
|
<titleabbrev>Get desired balance</titleabbrev>
|
|
|
|
++++
|
|
|
|
|
|
|
|
NOTE: {cloud-only}
|
|
|
|
|
|
|
|
Exposes the desired balance and basic metrics.
|
|
|
|
|
|
|
|
[[get-desired-balance-request]]
|
|
|
|
==== {api-request-title}
|
|
|
|
|
|
|
|
[source,console]
|
|
|
|
--------------------------------------------------
|
|
|
|
GET /_internal/desired_balance
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[skip:Can't reliably test desired balance]
|
|
|
|
|
|
|
|
The API returns the following result:
|
|
|
|
|
|
|
|
[source,console-result]
|
|
|
|
--------------------------------------------------
|
|
|
|
{
|
|
|
|
"stats": {
|
|
|
|
"computation_active": false,
|
|
|
|
"computation_submitted": 5,
|
|
|
|
"computation_executed": 5,
|
|
|
|
"computation_converged": 5,
|
|
|
|
"computation_iterations": 4,
|
|
|
|
"computation_converged_index": 4,
|
|
|
|
"computation_time_in_millis": 0,
|
|
|
|
"reconciliation_time_in_millis": 0
|
|
|
|
},
|
2023-01-09 17:57:10 +08:00
|
|
|
"cluster_balance_stats" : {
|
2023-02-02 23:13:01 +08:00
|
|
|
"tiers": {
|
2023-01-09 17:57:10 +08:00
|
|
|
"data_hot" : {
|
2023-02-02 23:13:01 +08:00
|
|
|
"shard_count" : {
|
|
|
|
"total" : 7.0,
|
|
|
|
"min" : 2.0,
|
|
|
|
"max" : 3.0,
|
|
|
|
"average" : 2.3333333333333335,
|
|
|
|
"std_dev" : 0.4714045207910317
|
2023-01-09 17:57:10 +08:00
|
|
|
},
|
2023-02-02 23:13:01 +08:00
|
|
|
"forecast_write_load" : {
|
2023-01-09 17:57:10 +08:00
|
|
|
"total" : 21.0,
|
|
|
|
"min" : 6.0,
|
|
|
|
"max" : 8.5,
|
|
|
|
"average" : 7.0,
|
|
|
|
"std_dev" : 1.0801234497346435
|
|
|
|
},
|
2023-02-02 23:13:01 +08:00
|
|
|
"forecast_disk_usage" : {
|
|
|
|
"total" : 36.0,
|
|
|
|
"min" : 10.0,
|
|
|
|
"max" : 16.0,
|
|
|
|
"average" : 12.0,
|
|
|
|
"std_dev" : 2.8284271247461903
|
2023-02-06 20:34:18 +08:00
|
|
|
},
|
|
|
|
"actual_disk_usage" : {
|
|
|
|
"total" : 36.0,
|
|
|
|
"min" : 10.0,
|
|
|
|
"max" : 16.0,
|
|
|
|
"average" : 12.0,
|
|
|
|
"std_dev" : 2.8284271247461903
|
2023-01-09 17:57:10 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"data_warm" : {
|
2023-02-02 23:13:01 +08:00
|
|
|
"shard_count" : {
|
|
|
|
"total" : 3.0,
|
|
|
|
"min" : 1.0,
|
|
|
|
"max" : 1.0,
|
|
|
|
"average" : 1.0,
|
|
|
|
"std_dev" : 0.0
|
2023-01-09 17:57:10 +08:00
|
|
|
},
|
2023-02-02 23:13:01 +08:00
|
|
|
"forecast_write_load" : {
|
2023-01-09 17:57:10 +08:00
|
|
|
"total" : 0.0,
|
|
|
|
"min" : 0.0,
|
|
|
|
"max" : 0.0,
|
|
|
|
"average" : 0.0,
|
|
|
|
"std_dev" : 0.0
|
|
|
|
},
|
2023-02-02 23:13:01 +08:00
|
|
|
"forecast_disk_usage" : {
|
|
|
|
"total" : 42.0,
|
|
|
|
"min" : 12.0,
|
|
|
|
"max" : 18.0,
|
|
|
|
"average" : 14.0,
|
|
|
|
"std_dev" : 2.8284271247461903
|
2023-02-06 20:34:18 +08:00
|
|
|
},
|
|
|
|
"actual_disk_usage" : {
|
|
|
|
"total" : 42.0,
|
|
|
|
"min" : 12.0,
|
|
|
|
"max" : 18.0,
|
|
|
|
"average" : 14.0,
|
|
|
|
"std_dev" : 2.8284271247461903
|
2023-01-09 17:57:10 +08:00
|
|
|
}
|
|
|
|
}
|
2023-02-02 23:13:01 +08:00
|
|
|
},
|
|
|
|
"nodes": {
|
|
|
|
"node-1": {
|
|
|
|
"shard_count": 10,
|
|
|
|
"forecast_write_load": 8.5,
|
2023-02-06 20:34:18 +08:00
|
|
|
"forecast_disk_usage_bytes": 498435,
|
|
|
|
"actual_disk_usage_bytes": 498435
|
2023-02-02 23:13:01 +08:00
|
|
|
},
|
|
|
|
"node-2": {
|
|
|
|
"shard_count": 15,
|
|
|
|
"forecast_write_load": 3.25,
|
2023-02-06 20:34:18 +08:00
|
|
|
"forecast_disk_usage_bytes": 384935,
|
|
|
|
"actual_disk_usage_bytes": 384935
|
2023-02-02 23:13:01 +08:00
|
|
|
},
|
|
|
|
"node-3": {
|
|
|
|
"shard_count": 12,
|
|
|
|
"forecast_write_load": 6.0,
|
2023-02-06 20:34:18 +08:00
|
|
|
"forecast_disk_usage_bytes": 648766,
|
|
|
|
"actual_disk_usage_bytes": 648766
|
2023-02-02 23:13:01 +08:00
|
|
|
}
|
2023-01-09 17:57:10 +08:00
|
|
|
}
|
|
|
|
},
|
DesiredBalance: expose it via _internal/desired_balance (#91038)
Add an internal endpoint for exposed the desired balance and computation stats at a master node as GET _internal/desired_balance and returns
```
{
"stats": {
"computation_active": false,
"computation_submitted": 5,
"computation_executed": 5,
"computation_converged": 5,
"computation_iterations": 4,
"computation_converged_index": 4,
"computation_time_in_millis": 0,
"reconciliation_time_in_millis": 0
},
"routing_table": {
"test": {
"0": {
"current": [
{
"state": "STARTED",
"primary": true,
"node": "UPYt8VwWTt-IADAEbqpLxA",
"node_is_desired": true,
"relocating_node": null,
"relocating_node_is_desired": false,
"shard_id": 0,
"index": "test"
}
],
"desired": {
"node_ids": [
"UPYt8VwWTt-IADAEbqpLxA"
],
"total": 1,
"unassigned": 0,
"ignored": 0
}
},
"1": {
"current": [
{
"state": "STARTED",
"primary": true,
"node": "2x1VTuSOQdeguXPdN73yRw",
"node_is_desired": true,
"relocating_node": null,
"relocating_node_is_desired": false,
"shard_id": 1,
"index": "test"
}
],
"desired": {
"node_ids": [
"2x1VTuSOQdeguXPdN73yRw"
],
"total": 1,
"unassigned": 0,
"ignored": 0
}
}
}
}
}
```
Fixes #90583
2022-11-16 09:54:10 +08:00
|
|
|
"routing_table": {
|
|
|
|
"test": {
|
|
|
|
"0": {
|
|
|
|
"current": [
|
|
|
|
{
|
|
|
|
"state": "STARTED",
|
|
|
|
"primary": true,
|
|
|
|
"node": "UPYt8VwWTt-IADAEbqpLxA",
|
|
|
|
"node_is_desired": true,
|
|
|
|
"relocating_node": null,
|
|
|
|
"relocating_node_is_desired": false,
|
|
|
|
"shard_id": 0,
|
2023-01-05 19:08:52 +08:00
|
|
|
"index": "test",
|
2023-02-02 23:13:01 +08:00
|
|
|
"forecast_write_load": 8.0,
|
|
|
|
"forecast_shard_size_in_bytes": 1024
|
DesiredBalance: expose it via _internal/desired_balance (#91038)
Add an internal endpoint for exposed the desired balance and computation stats at a master node as GET _internal/desired_balance and returns
```
{
"stats": {
"computation_active": false,
"computation_submitted": 5,
"computation_executed": 5,
"computation_converged": 5,
"computation_iterations": 4,
"computation_converged_index": 4,
"computation_time_in_millis": 0,
"reconciliation_time_in_millis": 0
},
"routing_table": {
"test": {
"0": {
"current": [
{
"state": "STARTED",
"primary": true,
"node": "UPYt8VwWTt-IADAEbqpLxA",
"node_is_desired": true,
"relocating_node": null,
"relocating_node_is_desired": false,
"shard_id": 0,
"index": "test"
}
],
"desired": {
"node_ids": [
"UPYt8VwWTt-IADAEbqpLxA"
],
"total": 1,
"unassigned": 0,
"ignored": 0
}
},
"1": {
"current": [
{
"state": "STARTED",
"primary": true,
"node": "2x1VTuSOQdeguXPdN73yRw",
"node_is_desired": true,
"relocating_node": null,
"relocating_node_is_desired": false,
"shard_id": 1,
"index": "test"
}
],
"desired": {
"node_ids": [
"2x1VTuSOQdeguXPdN73yRw"
],
"total": 1,
"unassigned": 0,
"ignored": 0
}
}
}
}
}
```
Fixes #90583
2022-11-16 09:54:10 +08:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"desired": {
|
|
|
|
"node_ids": [
|
|
|
|
"UPYt8VwWTt-IADAEbqpLxA"
|
|
|
|
],
|
|
|
|
"total": 1,
|
|
|
|
"unassigned": 0,
|
|
|
|
"ignored": 0
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"1": {
|
|
|
|
"current": [
|
|
|
|
{
|
|
|
|
"state": "STARTED",
|
|
|
|
"primary": true,
|
|
|
|
"node": "2x1VTuSOQdeguXPdN73yRw",
|
|
|
|
"node_is_desired": true,
|
|
|
|
"relocating_node": null,
|
|
|
|
"relocating_node_is_desired": false,
|
|
|
|
"shard_id": 1,
|
2023-01-05 19:08:52 +08:00
|
|
|
"index": "test",
|
2023-02-02 23:13:01 +08:00
|
|
|
"forecast_write_load": null,
|
|
|
|
"forecast_shard_size_in_bytes": null
|
DesiredBalance: expose it via _internal/desired_balance (#91038)
Add an internal endpoint for exposed the desired balance and computation stats at a master node as GET _internal/desired_balance and returns
```
{
"stats": {
"computation_active": false,
"computation_submitted": 5,
"computation_executed": 5,
"computation_converged": 5,
"computation_iterations": 4,
"computation_converged_index": 4,
"computation_time_in_millis": 0,
"reconciliation_time_in_millis": 0
},
"routing_table": {
"test": {
"0": {
"current": [
{
"state": "STARTED",
"primary": true,
"node": "UPYt8VwWTt-IADAEbqpLxA",
"node_is_desired": true,
"relocating_node": null,
"relocating_node_is_desired": false,
"shard_id": 0,
"index": "test"
}
],
"desired": {
"node_ids": [
"UPYt8VwWTt-IADAEbqpLxA"
],
"total": 1,
"unassigned": 0,
"ignored": 0
}
},
"1": {
"current": [
{
"state": "STARTED",
"primary": true,
"node": "2x1VTuSOQdeguXPdN73yRw",
"node_is_desired": true,
"relocating_node": null,
"relocating_node_is_desired": false,
"shard_id": 1,
"index": "test"
}
],
"desired": {
"node_ids": [
"2x1VTuSOQdeguXPdN73yRw"
],
"total": 1,
"unassigned": 0,
"ignored": 0
}
}
}
}
}
```
Fixes #90583
2022-11-16 09:54:10 +08:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"desired": {
|
|
|
|
"node_ids": [
|
|
|
|
"2x1VTuSOQdeguXPdN73yRw"
|
|
|
|
],
|
|
|
|
"total": 1,
|
|
|
|
"unassigned": 0,
|
|
|
|
"ignored": 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TEST[skip:Can't reliably test desired balance]
|