From 2421a34a541fc26c5b3846d0cf3b809f3261078a Mon Sep 17 00:00:00 2001 From: dblock Date: Mon, 25 Nov 2024 11:27:14 -0500 Subject: [PATCH] Fixed nodes usage responses. Signed-off-by: dblock --- CHANGELOG.md | 4 ++- spec/schemas/nodes.usage.yaml | 3 +- tests/default/nodes/stats.yaml | 11 +++++++ tests/default/nodes/usage.yaml | 60 ++++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 tests/default/nodes/usage.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index 24c96eac9..f42d6c47f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Added `PhoneAnalyzer` from `analysis-phonenumber` plugin ([#609](https://github.com/opensearch-project/opensearch-api-specification/pull/609)) - Added `/_list/indices` & `/_list/shards` api specs ([#613](https://github.com/opensearch-project/opensearch-api-specification/pull/613)) - Added `GET` and `HEAD /{index}/_source/{id}` returning `404` ([#673](https://github.com/opensearch-project/opensearch-api-specification/pull/673)) -- Added `rename_alias_pattern` and `rename_alias_replacment` to `/_snapshot/{repository}/{snapshot}/_restore` body parameters ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615)) +- Added `rename_alias_pattern` and `rename_alias_replacement` to `/_snapshot/{repository}/{snapshot}/_restore` body parameters ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615)) +- Added `aggregations` to `/nodes/_usage/{metric}` requests and responses ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615)) - Added `s` to `/_ingest/processor/grok` ([#689](https://github.com/opensearch-project/opensearch-api-specification/pull/689)) ### Removed @@ -40,6 +41,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fixed `value` type in `ExplanationDetail` and added `_type` to `explain@200` ([#685](https://github.com/opensearch-project/opensearch-api-specification/pull/685)) - Fixed index settings types ([#684](https://github.com/opensearch-project/opensearch-api-specification/pull/684)) - Fixed `POST` and `DELETE /_dangling/{index_uuid}` returning `202` ([#686](https://github.com/opensearch-project/opensearch-api-specification/pull/686)) +- Fixed response schema for `/_nodes/reload_secure_settings` and `/_nodes/{node_id}/reload_secure_settings` ([#694](https://github.com/opensearch-project/opensearch-api-specification/pull/694)) - Fixed `/_ingest/pipeline/{id}/_simulate` response `docs/_source` field schema ([#689](https://github.com/opensearch-project/opensearch-api-specification/pull/689)) ### Changed diff --git a/spec/schemas/nodes.usage.yaml b/spec/schemas/nodes.usage.yaml index 2ce22876e..19deeb842 100644 --- a/spec/schemas/nodes.usage.yaml +++ b/spec/schemas/nodes.usage.yaml @@ -10,6 +10,7 @@ components: type: string enum: - _all + - aggregations - rest_actions ResponseBase: allOf: @@ -41,7 +42,5 @@ components: additionalProperties: type: object required: - - aggregations - - rest_actions - since - timestamp diff --git a/tests/default/nodes/stats.yaml b/tests/default/nodes/stats.yaml index a54f284ae..8886d05e6 100644 --- a/tests/default/nodes/stats.yaml +++ b/tests/default/nodes/stats.yaml @@ -179,3 +179,14 @@ chapters: - search response: status: 200 + - synopsis: Get statistics for search (`node_id`). + path: /_nodes/{node_id}/stats/{metric}/{index_metric} + method: GET + parameters: + node_id: _all + metric: + - indices + index_metric: + - search + response: + status: 200 diff --git a/tests/default/nodes/usage.yaml b/tests/default/nodes/usage.yaml new file mode 100644 index 000000000..083bfcbd1 --- /dev/null +++ b/tests/default/nodes/usage.yaml @@ -0,0 +1,60 @@ +$schema: ../../../json_schemas/test_story.schema.yaml + +description: Test nodes usage. +chapters: + - synopsis: Get usage for all nodes. + path: /_nodes/usage + method: GET + response: + status: 200 + - synopsis: Get usage for all nodes for all metrics. + path: /_nodes/usage/{metric} + method: GET + parameters: + metric: + - _all + response: + status: 200 + - synopsis: Get usage for all nodes for the `rest_actions` metric. + path: /_nodes/usage/{metric} + method: GET + parameters: + metric: + - rest_actions + response: + status: 200 + - synopsis: Get usage for all nodes for the `aggregations` metric. + path: /_nodes/usage/{metric} + method: GET + parameters: + metric: + - aggregations + response: + status: 200 + - synopsis: Get usage for all nodes (`node_id`). + path: /_nodes/{node_id}/usage + method: GET + parameters: + node_id: _all + response: + status: 200 + - synopsis: Get usage for all nodes for all metrics (`node_id`). + path: /_nodes/{node_id}/usage/{metric} + method: GET + parameters: + node_id: _all + metric: + - _all + response: + status: 200 + - synopsis: Get usage for all nodes and all metrics. + warnings: + multiple-paths-detected: false + path: /_nodes/{node_id}/{metric} + method: GET + parameters: + node_id: _all + metric: + - _all + response: + status: 200