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
Introduce includeShardsStats in the stats request to indicate that we only fetch a summary #100466
Introduce includeShardsStats in the stats request to indicate that we only fetch a summary #100466
Conversation
Pinging @elastic/es-data-management (Team:Data Management) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basic idea seems good although I don't think it quite works as written yet.
server/src/main/java/org/elasticsearch/indices/IndicesService.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/action/admin/cluster/node/stats/NodesStatsRequest.java
Show resolved
Hide resolved
@@ -33,6 +34,7 @@ public class NodesStatsRequest extends BaseNodesRequest<NodesStatsRequest> { | |||
|
|||
private CommonStatsFlags indices = new CommonStatsFlags(); | |||
private final Set<String> requestedMetrics = new HashSet<>(); | |||
private boolean needShardsStats = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming nit/suggestion:
private boolean needShardsStats = true; | |
private boolean includeShardsStats = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. Fixed in 373cc6f
@elasticmachine test this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks that looks better. Now this needs some tests showing that we do/don't drop the shard-level stats depending on the flag.
I'll trigger another CI run to see if it picks up anything I missed.
I left some inline nits too.
server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/indices/NodeIndicesStatsTests.java
Outdated
Show resolved
Hide resolved
...ugin/core/src/test/java/org/elasticsearch/xpack/core/DataTiersUsageTransportActionTests.java
Show resolved
Hide resolved
...test/java/org/elasticsearch/xpack/monitoring/collector/node/NodeStatsMonitoringDocTests.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/indices/NodeIndicesStats.java
Outdated
Show resolved
Hide resolved
@elasticmachine test this please |
…er/RestNodesStatsAction.java Co-authored-by: David Turner <david.turner@elastic.co>
…s.java Co-authored-by: David Turner <david.turner@elastic.co>
…/monitoring/collector/node/NodeStatsMonitoringDocTests.java Co-authored-by: David Turner <david.turner@elastic.co>
…DataTiersUsageTransportActionTests.java Co-authored-by: David Turner <david.turner@elastic.co>
…sTests.java Co-authored-by: David Turner <david.turner@elastic.co>
I added some tests in 8543023 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one substantive request about exposing the whole stats map vs testing it by accessing the stats for a single index.
// for testing | ||
Map<Index, List<IndexShardStats>> getStatsByShard() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we test this via getShardStats(Index index)
instead please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we test this via getShardStats(Index index)
in 3ddf821
server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java
Outdated
Show resolved
Hide resolved
@@ -136,7 +136,7 @@ static TransportVersion def(int id) { | |||
public static final TransportVersion ML_PACKAGE_LOADER_PLATFORM_ADDED = def(8_512_00_0); | |||
public static final TransportVersion PLUGIN_DESCRIPTOR_OPTIONAL_CLASSNAME = def(8_513_00_0); | |||
public static final TransportVersion UNIVERSAL_PROFILING_LICENSE_ADDED = def(8_514_00_0); | |||
|
|||
public static final TransportVersion NEED_SHARDS_STATS_ADDED = def(8_515_00_0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
naming nit
public static final TransportVersion NEED_SHARDS_STATS_ADDED = def(8_515_00_0); | |
public static final TransportVersion INCLUDE_SHARDS_STATS_ADDED = def(8_515_00_0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's replaced in 9d20eda
@elasticmachine test this please |
The CI failures all seem to relate to the branch being stale, you'll just need to merge |
…er/RestNodesStatsAction.java Co-authored-by: David Turner <david.turner@elastic.co>
….INCLUDE_SHARDS_STATS_ADDED
The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@elasticmachine test this please |
I think we could reasonably indicate |
According to the CI failure message, it seems that |
Ah yes indeed it should be. See also #100230, because it'd be better for this action not to use node stats at all. |
@elasticmachine test this please |
I have finished it in #100938. |
relates #99744