Skip to content

Commit

Permalink
Added AwarenessAttributeStats to /_cluster/health.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Aug 27, 2024
1 parent 3a9caa7 commit dad6769
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Added 404 responses to `/_alias/{name}` and `/{index}/_alias/{name}` ([#519](https://github.com/opensearch-project/opensearch-api-specification/pull/519))
- Added `asynchronous_search` ([#525](https://github.com/opensearch-project/opensearch-api-specification/pull/525))
- Added `DELETE /_plugins/_ml/tasks/{task_id}` ([#530](https://github.com/opensearch-project/opensearch-api-specification/pull/530))
- Added `AwarenessAttributeStats` to `/_cluster/health` ([#534](https://github.com/opensearch-project/opensearch-api-specification/pull/534))

### Changed

Expand Down
32 changes: 31 additions & 1 deletion spec/schemas/cluster.health.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,25 @@ components:
type: number
active_shards_percent_as_number:
$ref: '_common.yaml#/components/schemas/Percentage'
awareness_attributes:
description: Cluster health information for each awareness attribute.
type: object
x-version-added: '2.5'
additionalProperties:
$ref: '#/components/schemas/AwarenessAttributeStats'
cluster_name:
$ref: '_common.yaml#/components/schemas/Name'
delayed_unassigned_shards:
description: The number of shards whose allocation has been delayed by the timeout settings.
type: number
discovered_master:
description: True if the master node has been discovered.
type: boolean
x-version-deprecated: 2
discovered_cluster_manager:
description: True if the cluster manager node has been discovered.
type: boolean
x-version-added: 2
indices:
type: object
additionalProperties:
Expand Down Expand Up @@ -51,7 +65,7 @@ components:
task_max_waiting_in_queue_millis:
$ref: '_common.yaml#/components/schemas/DurationValueUnitMillis'
timed_out:
description: If false the response returned within the period of time that is specified by the timeout parameter (30s by default)
description: If false the response returned within the period of time that is specified by the timeout parameter (30s by default).
type: boolean
unassigned_shards:
description: The number of shards that are not allocated.
Expand Down Expand Up @@ -111,6 +125,22 @@ components:
- cluster
- indices
- shards
AwarenessAttributeStats:
type: object
x-version-added: '2.5'
properties:
active_shards:
type: number
initializing_shards:
type: number
relocating_shards:
type: number
unassigned_shards:
type: number
data_nodes:
type: number
weight:
type: number
ShardHealthStats:
type: object
properties:
Expand Down
28 changes: 28 additions & 0 deletions tests/default/cluster/health.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
$schema: ../../../json_schemas/test_story.schema.yaml

description: Test cluster health.
chapters:
- synopsis: Returns a simple status of the health of the cluster.
path: /_cluster/health
method: GET
parameters:
expand_wildcards: all
level: cluster
local: false
timeout: 10s
wait_for_active_shards: 0
wait_for_nodes: <2
wait_for_events: normal
wait_for_no_relocating_shards: false
wait_for_no_initializing_shards: false
response:
status: 200
- synopsis: Returns a status of the health of the cluster with awareness.
version: '>= 2.5'
path: /_cluster/health
method: GET
parameters:
level: awareness_attributes
awareness_attribute: zone
response:
status: 200
29 changes: 29 additions & 0 deletions tests/default/cluster/health/index.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$schema: ../../../../json_schemas/test_story.schema.yaml

description: Test cluster health for an index.
prologues:
- path: /{index}
method: PUT
parameters:
index: books
epilogues:
- path: /books
method: DELETE
status: [200, 404]
chapters:
- synopsis: Returns a status of the health of the cluster for a given index.
path: /_cluster/health/{index}
method: GET
parameters:
index: books
expand_wildcards: all
level: cluster
local: false
timeout: 10s
wait_for_active_shards: 0
wait_for_nodes: <2
wait_for_events: normal
wait_for_no_relocating_shards: false
wait_for_no_initializing_shards: false
response:
status: 200

0 comments on commit dad6769

Please sign in to comment.