Skip to content

Commit

Permalink
Fixed nodes usage responses.
Browse files Browse the repository at this point in the history
Signed-off-by: dblock <[email protected]>
  • Loading branch information
dblock committed Nov 25, 2024
1 parent 72d477f commit bcc099c
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 6 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ 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 `resource_stats` to `TaskInfoBase` ([#692](https://github.com/opensearch-project/opensearch-api-specification/pull/692))
- Added `s` to `/_ingest/processor/grok` ([#689](https://github.com/opensearch-project/opensearch-api-specification/pull/689))
- Added `aggregations` to `/nodes/_usage/{metric}` requests and responses ([#615](https://github.com/opensearch-project/opensearch-api-specification/pull/615))

### Removed
- Removed unsupported `_common.mapping:SourceField`'s `mode` field and associated `_common.mapping:SourceFieldMode` enum ([#652](https://github.com/opensearch-project/opensearch-api-specification/pull/652))
Expand All @@ -41,6 +42,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
Expand Down
2 changes: 1 addition & 1 deletion spec/namespaces/nodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ components:
content:
application/json:
schema:
$ref: '../schemas/nodes.reload_secure_settings.yaml#/components/schemas/NodeReloadResponse'
$ref: '../schemas/nodes.reload_secure_settings.yaml#/components/schemas/ResponseBase'
nodes.stats@200:
content:
application/json:
Expand Down
4 changes: 2 additions & 2 deletions spec/schemas/nodes._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ components:
_nodes:
$ref: '_common.yaml#/components/schemas/NodeStatistics'
NodeReloadResult:
oneOf:
- $ref: '#/components/schemas/Stats'
anyOf:
- $ref: '#/components/schemas/NodeReloadResponse'
- $ref: '#/components/schemas/NodeReloadError'
Stats:
type: object
Expand Down
3 changes: 1 addition & 2 deletions spec/schemas/nodes.usage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ components:
type: string
enum:
- _all
- aggregations
- rest_actions
ResponseBase:
allOf:
Expand Down Expand Up @@ -41,7 +42,5 @@ components:
additionalProperties:
type: object
required:
- aggregations
- rest_actions
- since
- timestamp
11 changes: 11 additions & 0 deletions tests/default/nodes/stats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
60 changes: 60 additions & 0 deletions tests/default/nodes/usage.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit bcc099c

Please sign in to comment.