Skip to content

Commit

Permalink
Split Percentage into PercentageNumber, PercentageString (#573)
Browse files Browse the repository at this point in the history
Signed-off-by: Jakob Hahn <jakob.hahn@hetzner.com>
  • Loading branch information
Jakob3xD authored Sep 13, 2024
1 parent 97cfa9b commit 584d525
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 33 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Corrected Sort schema for `/_search`'s request body ([#529](https://github.com/opensearch-project/opensearch-api-specification/issues/529))
- Rename `Bytes` component to `StorageType` ([#552](https://github.com/opensearch-project/opensearch-api-specification/pull/552))
- Rename `ByteSize` to `StorageSize` ([#552](https://github.com/opensearch-project/opensearch-api-specification/pull/552))
- Split `Percentage` into `PercentageNumber`, `PercentageString` ([#573](https://github.com/opensearch-project/opensearch-api-specification/pull/573))

### Deprecated

Expand Down
9 changes: 5 additions & 4 deletions spec/schemas/_common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,11 @@ components:
ByteCount:
type: integer
format: int64
Percentage:
oneOf:
- type: string
- type: number
PercentageNumber:
type: number
PercentageString:
type: string
pattern: '\d+(\.\d+)?'
Host:
type: string
Ip:
Expand Down
4 changes: 2 additions & 2 deletions spec/schemas/cat._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ components:
files_fetched:
type: string
files_percent:
type: string
$ref: '_common.yaml#/components/schemas/PercentageString'
bytes_fetched:
type: string
bytes_percent:
type: string
$ref: '_common.yaml#/components/schemas/PercentageString'
start_time:
type: string
stop_time:
Expand Down
2 changes: 1 addition & 1 deletion spec/schemas/cat.allocation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ components:
disk.percent:
description: Total percentage of disk space in use. Calculated as `disk.used / disk.total`.
oneOf:
- $ref: '_common.yaml#/components/schemas/Percentage'
- $ref: '_common.yaml#/components/schemas/PercentageString'
- type: 'null'
host:
description: Network host for the node. Set using the `network.host` setting.
Expand Down
2 changes: 1 addition & 1 deletion spec/schemas/cat.health.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ components:
type: string
active_shards_percent:
description: active number of shards in percent
type: string
$ref: '_common.yaml#/components/schemas/PercentageString'
discovered_cluster_manager:
description: cluster manager is discovered or not
type: string
Expand Down
8 changes: 4 additions & 4 deletions spec/schemas/cat.nodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,28 @@ components:
disk.avail:
type: string
disk.used_percent:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageString'
heap.current:
description: The used heap.
type: string
heap.percent:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageString'
heap.max:
description: The maximum configured heap.
type: string
ram.current:
description: The used machine memory.
type: string
ram.percent:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageString'
ram.max:
description: The total machine memory.
type: string
file_desc.current:
description: The used file descriptors.
type: string
file_desc.percent:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageString'
file_desc.max:
description: The maximum number of file descriptors.
type: string
Expand Down
6 changes: 3 additions & 3 deletions spec/schemas/cat.recovery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ components:
description: The files recovered.
type: string
files_percent:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageString'
files_total:
description: The total number of files.
type: string
Expand All @@ -66,7 +66,7 @@ components:
description: The bytes recovered.
type: string
bytes_percent:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageString'
bytes_total:
description: The total number of bytes.
type: string
Expand All @@ -77,4 +77,4 @@ components:
description: The translog operations recovered.
type: string
translog_ops_percent:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageString'
4 changes: 2 additions & 2 deletions spec/schemas/cluster.allocation_explain.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ components:
free_bytes:
$ref: '_common.yaml#/components/schemas/ByteCount'
free_disk_percent:
type: number
$ref: '_common.yaml#/components/schemas/PercentageNumber'
used_disk_percent:
type: number
$ref: '_common.yaml#/components/schemas/PercentageNumber'
required:
- free_bytes
- free_disk_percent
Expand Down
4 changes: 3 additions & 1 deletion spec/schemas/cluster.health.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ components:
active_shards:
description: The total number of active primary and replica shards.
type: number
active_shards_percent:
$ref: '_common.yaml#/components/schemas/PercentageString'
active_shards_percent_as_number:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageNumber'
awareness_attributes:
description: Cluster health information for each awareness attribute.
type: object
Expand Down
6 changes: 3 additions & 3 deletions spec/schemas/cluster.stats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ components:
$ref: '_common.yaml#/components/schemas/ByteCount'
free_percent:
description: Percentage of free physical memory across all selected nodes.
type: number
$ref: '_common.yaml#/components/schemas/PercentageNumber'
total:
description: Total amount of physical memory across all selected nodes.
$ref: '_common.yaml#/components/schemas/HumanReadableByteCount'
Expand All @@ -669,7 +669,7 @@ components:
$ref: '_common.yaml#/components/schemas/ByteCount'
used_percent:
description: Percentage of physical memory in use across all selected nodes.
type: number
$ref: '_common.yaml#/components/schemas/PercentageNumber'
required:
- free_in_bytes
- free_percent
Expand Down Expand Up @@ -730,7 +730,7 @@ components:
description: |-
Percentage of CPU used across all selected nodes.
Returns `-1` if not supported.
type: number
$ref: '_common.yaml#/components/schemas/PercentageNumber'
required:
- percent
ClusterProcessOpenFileDescriptors:
Expand Down
6 changes: 3 additions & 3 deletions spec/schemas/indices.recovery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ components:
type: object
properties:
percent:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageString'
recovered:
$ref: '_common.yaml#/components/schemas/HumanReadableByteCount'
recovered_in_bytes:
Expand Down Expand Up @@ -123,7 +123,7 @@ components:
items:
$ref: '#/components/schemas/FileDetails'
percent:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageString'
recovered:
type: number
reused:
Expand Down Expand Up @@ -193,7 +193,7 @@ components:
type: object
properties:
percent:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageString'
recovered:
type: number
total:
Expand Down
20 changes: 11 additions & 9 deletions spec/schemas/nodes._common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ components:
failed:
description: Number of failed operations for the processor.
type: number
time:
$ref: '_common.yaml#/components/schemas/Duration'
time_in_millis:
$ref: '_common.yaml#/components/schemas/DurationValueUnitMillis'
ThreadCount:
Expand Down Expand Up @@ -346,16 +348,16 @@ components:
timestamp:
type: number
cpu_utilization_percent:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageString'
memory_utilization_percent:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageString'
io_usage_stats:
$ref: '#/components/schemas/ShardResourceUsageStatsIoUsageStats'
ShardResourceUsageStatsIoUsageStats:
type: object
properties:
max_io_utilization_percent:
$ref: '_common.yaml#/components/schemas/Percentage'
$ref: '_common.yaml#/components/schemas/PercentageString'
ShardSegmentReplicationBackpressureStats:
type: object
properties:
Expand Down Expand Up @@ -677,7 +679,7 @@ components:
$ref: '_common.yaml#/components/schemas/ByteCount'
heap_used_percent:
description: Percentage of memory currently in use by the heap.
type: number
$ref: '_common.yaml#/components/schemas/PercentageNumber'
heap_committed:
description: Amount of memory available for use by the heap.
$ref: '_common.yaml#/components/schemas/HumanReadableByteCount'
Expand Down Expand Up @@ -749,7 +751,7 @@ components:
max_in_bytes:
$ref: '_common.yaml#/components/schemas/ByteCount'
usage_percent:
type: number
$ref: '_common.yaml#/components/schemas/PercentageNumber'
JvmThreads:
type: object
properties:
Expand All @@ -776,7 +778,7 @@ components:
type: object
properties:
percent:
type: number
$ref: '_common.yaml#/components/schemas/PercentageNumber'
sys:
$ref: '_common.yaml#/components/schemas/Duration'
sys_in_millis:
Expand All @@ -800,10 +802,10 @@ components:
properties:
free_percent:
description: Percentage of free memory.
type: number
$ref: '_common.yaml#/components/schemas/PercentageNumber'
used_percent:
description: Percentage of used memory.
type: number
$ref: '_common.yaml#/components/schemas/PercentageNumber'
MemoryStats:
type: object
properties:
Expand Down Expand Up @@ -1224,7 +1226,7 @@ components:
cancellation_limit_reached_count:
type: number
cancelled_task_percentage:
type: number
$ref: '_common.yaml#/components/schemas/PercentageNumber'
current_cancellation_eligible_tasks_count:
type: number
TotalRejectionsBreakup:
Expand Down
1 change: 1 addition & 0 deletions tests/default/cluster/health.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ chapters:
expand_wildcards: all
level: cluster
local: false
human: true
timeout: 10s
wait_for_active_shards: 0
wait_for_nodes: <2
Expand Down

0 comments on commit 584d525

Please sign in to comment.