Skip to content

Support include_unloaded_segments in node stats #69721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/reference/cat/nodes.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Valid columns are:
`s` (content node),
`t` ({transform} node),
`v` (voting-only node),
`w` (warm node), and
`w` (warm node), and
`-` (coordinating node only).
+
For example, `dim` indicates a master-eligible data and ingest node. See
Expand Down Expand Up @@ -325,6 +325,7 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=time]

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=cat-v]

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=include-unloaded-segments]

[[cat-nodes-api-example]]
==== {api-examples-title}
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/cluster/nodes-stats.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms]

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=include-segment-file-sizes]

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=include-unloaded-segments]

[role="child_attributes"]
[[cluster-nodes-stats-api-response-body]]
==== {api-response-body-title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@
"type":"boolean",
"description":"Verbose mode. Display column headers",
"default":false
},
"include_unloaded_segments":{
"type":"boolean",
"description":"If set to true segment stats will include stats for segments that are not currently loaded into memory",
"default":false
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@
"type":"boolean",
"description":"Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)",
"default":false
},
"include_unloaded_segments":{
"type":"boolean",
"description":"If set to true segment stats will include stats for segments that are not currently loaded into memory",
"default":false
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,51 @@ setup:
- is_false: _all.total.translog
- is_false: _all.total.recovery
- is_true: _all.total.segments.file_sizes

---
"Metric - _all include_unloaded_segments":
- skip:
version: " - 7.1.99"
reason: "support for include_unloaded_segments only added in 7.2"
- do:
indices.stats: { metric: _all, include_unloaded_segments: true }

- is_true: _all.total.docs
- is_true: _all.total.store
- is_true: _all.total.indexing
- is_true: _all.total.get
- is_true: _all.total.search
- is_true: _all.total.merges
- is_true: _all.total.refresh
- is_true: _all.total.flush
- is_true: _all.total.warmer
- is_true: _all.total.query_cache
- is_true: _all.total.fielddata
- is_true: _all.total.completion
- is_true: _all.total.segments
- is_true: _all.total.translog
- is_true: _all.total.recovery

---
"Metric - segments include_unloaded_segments":
- skip:
version: " - 7.1.99"
reason: "support for include_unloaded_segments only added in 7.2"
- do:
indices.stats: { metric: segments, include_unloaded_segments: true }

- is_false: _all.total.docs
- is_false: _all.total.store
- is_false: _all.total.indexing
- is_false: _all.total.get
- is_false: _all.total.search
- is_false: _all.total.merges
- is_false: _all.total.refresh
- is_false: _all.total.flush
- is_false: _all.total.warmer
- is_false: _all.total.query_cache
- is_false: _all.total.fielddata
- is_false: _all.total.completion
- is_true: _all.total.segments
- is_false: _all.total.translog
- is_false: _all.total.recovery
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,62 @@
- is_false: nodes.$node_id.indices.recovery
- is_true: nodes.$node_id.indices.segments.file_sizes

---
"Metric - _all include_unloaded_segments":
- skip:
features: [arbitrary_key]
version: " - 7.12.99"
reason: "support for include_unloaded_segments only added in 7.13"
- do:
nodes.info: {}
- set:
nodes._arbitrary_key_: node_id

- do:
nodes.stats: { metric: indices, index_metric: _all, include_unloaded_segments: true }

- is_true: nodes.$node_id.indices.docs
- is_true: nodes.$node_id.indices.store
- is_true: nodes.$node_id.indices.indexing
- is_true: nodes.$node_id.indices.get
- is_true: nodes.$node_id.indices.search
- is_true: nodes.$node_id.indices.merges
- is_true: nodes.$node_id.indices.refresh
- is_true: nodes.$node_id.indices.flush
- is_true: nodes.$node_id.indices.warmer
- is_true: nodes.$node_id.indices.query_cache
- is_true: nodes.$node_id.indices.fielddata
- is_true: nodes.$node_id.indices.completion
- is_true: nodes.$node_id.indices.segments
- is_true: nodes.$node_id.indices.translog
- is_true: nodes.$node_id.indices.recovery

---
"Metric - segments include_unloaded_segments":
- skip:
features: [arbitrary_key]
version: " - 7.12.99"
reason: "support for include_unloaded_segments only added in 7.13"
- do:
nodes.info: {}
- set:
nodes._arbitrary_key_: node_id

- do:
nodes.stats: { metric: indices, index_metric: segments, include_unloaded_segments: true }

- is_false: nodes.$node_id.indices.docs
- is_false: nodes.$node_id.indices.store
- is_false: nodes.$node_id.indices.indexing
- is_false: nodes.$node_id.indices.get
- is_false: nodes.$node_id.indices.search
- is_false: nodes.$node_id.indices.merges
- is_false: nodes.$node_id.indices.refresh
- is_false: nodes.$node_id.indices.flush
- is_false: nodes.$node_id.indices.warmer
- is_false: nodes.$node_id.indices.query_cache
- is_false: nodes.$node_id.indices.fielddata
- is_false: nodes.$node_id.indices.completion
- is_true: nodes.$node_id.indices.segments
- is_false: nodes.$node_id.indices.translog
- is_false: nodes.$node_id.indices.recovery
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
}
if (nodesStatsRequest.indices().isSet(Flag.Segments)) {
nodesStatsRequest.indices().includeSegmentFileSizes(request.paramAsBoolean("include_segment_file_sizes", false));
nodesStatsRequest.indices().includeUnloadedSegments(request.paramAsBoolean("include_unloaded_segments", false));
}

return channel -> client.admin().cluster().nodesStats(nodesStatsRequest, new NodesResponseRestListener<>(channel));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public RestChannelConsumer doCatRequest(final RestRequest request, final NodeCli
clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local()));
clusterStateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterStateRequest.masterNodeTimeout()));
final boolean fullId = request.paramAsBoolean("full_id", false);
final boolean includeUnloadedSegments = request.paramAsBoolean("include_unloaded_segments", false);
return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener<ClusterStateResponse>(channel) {
@Override
public void processResponse(final ClusterStateResponse clusterStateResponse) {
Expand All @@ -109,6 +110,7 @@ public void processResponse(final NodesInfoResponse nodesInfoResponse) {
NodesStatsRequest.Metric.PROCESS.metricName(),
NodesStatsRequest.Metric.SCRIPT.metricName()
);
nodesStatsRequest.indices().includeUnloadedSegments(includeUnloadedSegments);
client.admin().cluster().nodesStats(nodesStatsRequest, new RestResponseListener<NodesStatsResponse>(channel) {
@Override
public RestResponse buildResponse(NodesStatsResponse nodesStatsResponse) throws Exception {
Expand Down