Skip to content

Commit

Permalink
Add spec for cluster stats metric and index_metric filter paths.
Browse files Browse the repository at this point in the history
Signed-off-by: Swetha Guptha <gupthasg@amazon.com>
  • Loading branch information
Swetha Guptha committed Oct 24, 2024
1 parent 352e620 commit 842f996
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 0 deletions.
54 changes: 54 additions & 0 deletions spec/namespaces/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,39 @@ paths:
responses:
'200':
$ref: '#/components/responses/cluster.stats@200'
/_cluster/stats/{metric}/nodes/{node_id}:
get:
operationId: cluster.stats.2
x-operation-group: cluster.stats
x-version-added: '2.18'
description: Returns high-level overview of cluster statistics.
externalDocs:
url: https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-stats/
parameters:
- $ref: '#/components/parameters/cluster.stats::path.metric'
- $ref: '#/components/parameters/cluster.stats::path.node_id'
- $ref: '#/components/parameters/cluster.stats::query.flat_settings'
- $ref: '#/components/parameters/cluster.stats::query.timeout'
responses:
'200':
$ref: '#/components/responses/cluster.stats@200'
/_cluster/stats/{metric}/{index_metric}/nodes/{node_id}:
get:
operationId: cluster.stats.3
x-operation-group: cluster.stats
x-version-added: '2.18'
description: Returns high-level overview of cluster statistics.
externalDocs:
url: https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-stats/
parameters:
- $ref: '#/components/parameters/cluster.stats::path.index_metric'
- $ref: '#/components/parameters/cluster.stats::path.metric'
- $ref: '#/components/parameters/cluster.stats::path.node_id'
- $ref: '#/components/parameters/cluster.stats::query.flat_settings'
- $ref: '#/components/parameters/cluster.stats::query.timeout'
responses:
'200':
$ref: '#/components/responses/cluster.stats@200'
/_cluster/voting_config_exclusions:
post:
operationId: cluster.post_voting_config_exclusions.0
Expand Down Expand Up @@ -1380,6 +1413,27 @@ components:
schema:
$ref: '../schemas/_common.yaml#/components/schemas/Duration'
style: form
cluster.stats::path.index_metric:
in: path
name: index_metric
description: Limit the information returned for indices metric to the specific index metrics. It can be used only if indices (or all) metric is specified.
required: true
schema:
type: array
items:
$ref: '../schemas/cluster.stats.yaml#/components/schemas/IndexMetric'
style: simple
cluster.stats::path.metric:
in: path
name: metric
description: Limit the information returned to the specified metrics
required: true
schema:
type: array
items:
$ref: '../schemas/cluster.stats.yaml#/components/schemas/Metric'
style:
simple
cluster.stats::path.node_id:
in: path
name: node_id
Expand Down
27 changes: 27 additions & 0 deletions spec/schemas/cluster.stats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -689,3 +689,30 @@ components:
- avg
- max
- min
Metric:
type: string
enum:
- _all
- indices
- os
- process
- jvm

Check failure on line 699 in spec/schemas/cluster.stats.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected sequence values to be in ascending order. 'jvm' should be before 'process'
- fs

Check failure on line 700 in spec/schemas/cluster.stats.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected sequence values to be in ascending order. 'fs' should be before 'jvm'
- plugins
- network_types

Check failure on line 702 in spec/schemas/cluster.stats.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected sequence values to be in ascending order. 'network_types' should be before 'plugins'
- discovery_type

Check failure on line 703 in spec/schemas/cluster.stats.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected sequence values to be in ascending order. 'discovery_type' should be before 'network_types'
- packaging_types
- ingest

Check failure on line 705 in spec/schemas/cluster.stats.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected sequence values to be in ascending order. 'ingest' should be before 'packaging_types'
IndexMetric:
type: string
enum:
- _all
- shards
- docs

Check failure on line 711 in spec/schemas/cluster.stats.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected sequence values to be in ascending order. 'docs' should be before 'shards'
- store
- fielddata

Check failure on line 713 in spec/schemas/cluster.stats.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected sequence values to be in ascending order. 'fielddata' should be before 'store'
- query_cache
- completion

Check failure on line 715 in spec/schemas/cluster.stats.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected sequence values to be in ascending order. 'completion' should be before 'query_cache'
- segments
- mappings

Check failure on line 717 in spec/schemas/cluster.stats.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected sequence values to be in ascending order. 'mappings' should be before 'segments'
- analysis

Check failure on line 718 in spec/schemas/cluster.stats.yaml

View workflow job for this annotation

GitHub Actions / lint

Expected sequence values to be in ascending order. 'analysis' should be before 'mappings'
17 changes: 17 additions & 0 deletions tests/default/cluster/stats/index_metric.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
$schema: ../../../../json_schemas/test_story.schema.yaml

description: Test cluster manager stats.
version: '>= 2.18'
chapters:
- synopsis: Get mapping and analysis indices stats.
path: /_cluster/stats/{metric}/{index_metric}/nodes/{node_id}
method: GET
parameters:
node_id: _all
metric:
- indices
index_metric:
- mappings
- analysis
response:
status: 200
15 changes: 15 additions & 0 deletions tests/default/cluster/stats/metric.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$schema: ../../../../json_schemas/test_story.schema.yaml

description: Test cluster manager stats.
version: '>= 2.18'
chapters:
- synopsis: Get nodes fs and jvm stats.
path: /_cluster/stats/{metric}/nodes/{node_id}
method: GET
parameters:
node_id: _all
metric:
- fs
- jvm
response:
status: 200

0 comments on commit 842f996

Please sign in to comment.