Skip to content

Commit ddc225d

Browse files
l-trottapquentin
andauthored
Fixing cluster stats response (#4632)
* fixing cluster stats response * addressing review with more fixes * update healthstatus enums * addressing review * add fielddata, more comments * fix type dense vector fields * fixed raw values not nullable --------- Co-authored-by: Quentin Pradet <quentin.pradet@elastic.co>
1 parent b982f45 commit ddc225d

File tree

6 files changed

+276
-50
lines changed

6 files changed

+276
-50
lines changed

specification/_global/health_report/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export enum IndicatorHealthStatus {
2626
green,
2727
yellow,
2828
red,
29-
unknown
29+
unknown,
30+
unavailable
3031
}
3132

3233
export class Indicators {

specification/_types/Stats.ts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,35 @@ export class DocStats {
109109
* Elasticsearch reclaims the disk space of deleted Lucene documents when a segment is merged.
110110
*/
111111
deleted?: long
112+
/**
113+
* Returns the total size in bytes of all documents in this stats.
114+
* This value may be more reliable than store_stats.size_in_bytes in estimating the index size.
115+
*/
116+
total_size_in_bytes: long
117+
/**
118+
* Human readable total_size_in_bytes
119+
*/
120+
total_size?: ByteSize
112121
}
113122

114123
export class FielddataStats {
115124
evictions?: long
116125
memory_size?: ByteSize
117126
memory_size_in_bytes: long
118127
fields?: Dictionary<Field, FieldMemoryUsage>
128+
global_ordinals: GlobalOrdinalsStats
129+
}
130+
131+
export class GlobalOrdinalsStats {
132+
build_time_in_millis: UnitMillis
133+
build_time?: string
134+
fields?: Dictionary<Name, GlobalOrdinalFieldStats>
135+
}
136+
137+
export class GlobalOrdinalFieldStats {
138+
build_time_in_millis: UnitMillis
139+
build_time?: string
140+
shard_max_value_count: long
119141
}
120142

121143
export class FieldMemoryUsage {
@@ -307,7 +329,6 @@ export class SegmentsStats {
307329
* Total amount of memory used by all index writers across all shards assigned to selected nodes.
308330
*/
309331
index_writer_memory?: ByteSize
310-
index_writer_max_memory_in_bytes?: long
311332
/**
312333
* Total amount, in bytes, of memory used by all index writers across all shards assigned to selected nodes.
313334
*/
@@ -340,11 +361,14 @@ export class SegmentsStats {
340361
* Total amount, in bytes, of memory used for points across all shards assigned to selected nodes.
341362
*/
342363
points_memory_in_bytes: long
343-
stored_memory?: ByteSize
344364
/**
345365
* Total amount, in bytes, of memory used for stored fields across all shards assigned to selected nodes.
346366
*/
347367
stored_fields_memory_in_bytes: long
368+
/**
369+
* Total amount of memory used for stored fields across all shards assigned to selected nodes.
370+
*/
371+
stored_fields_memory?: ByteSize
348372
/**
349373
* Total amount, in bytes, of memory used for terms across all shards assigned to selected nodes.
350374
*/
@@ -356,7 +380,7 @@ export class SegmentsStats {
356380
/**
357381
* Total amount of memory used for term vectors across all shards assigned to selected nodes.
358382
*/
359-
term_vectory_memory?: ByteSize
383+
term_vectors_memory?: ByteSize
360384
/**
361385
* Total amount, in bytes, of memory used for term vectors across all shards assigned to selected nodes.
362386
*/

specification/_types/common.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,9 @@ export enum HealthStatus {
232232
* One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary shards are assigned.
233233
* @aliases RED
234234
*/
235-
red
235+
red,
236+
unknown,
237+
unavailable
236238
}
237239

238240
export enum HttpMethod {

specification/cluster/stats/ClusterStatsResponse.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@
2020
import { HealthStatus, Name, Uuid } from '@_types/common'
2121
import { long } from '@_types/Numeric'
2222
import { NodesResponseBase } from '@nodes/_types/NodesResponseBase'
23-
import { CCSStats, ClusterIndices, ClusterNodes } from './types'
23+
import { Dictionary } from '@spec_utils/Dictionary'
24+
import {
25+
CCSStats,
26+
ClusterIndices,
27+
ClusterNodes,
28+
ClusterSnapshotStats
29+
} from './types'
2430

2531
export class StatsResponseBase extends NodesResponseBase {
2632
/**
@@ -40,10 +46,18 @@ export class StatsResponseBase extends NodesResponseBase {
4046
* @doc_id cluster-nodes
4147
*/
4248
nodes: ClusterNodes
49+
/**
50+
* Contains stats on repository feature usage exposed in cluster stats for telemetry.
51+
*/
52+
repositories: Dictionary<Name, Dictionary<Name, long>>
53+
/**
54+
* Contains stats cluster snapshots.
55+
*/
56+
snapshots: ClusterSnapshotStats
4357
/**
4458
* Health status of the cluster, based on the state of its primary and replica shards.
4559
*/
46-
status: HealthStatus
60+
status?: HealthStatus
4761
/**
4862
* Unix timestamp, in milliseconds, for the last time the cluster statistics were refreshed.
4963
*/

0 commit comments

Comments
 (0)