-
Notifications
You must be signed in to change notification settings - Fork 25.2k
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
Include search idle info to shard stats #95740
Include search idle info to shard stats #95740
Conversation
Pinging @elastic/es-analytics-geo (Team:Analytics) |
Pinging @elastic/es-search (Team:Search) |
Hi @salvatore-campagna, I've created a changelog YAML for you. |
Hi @salvatore-campagna, I've updated the changelog YAML for you. |
The test checks just that the setting is applied, there is no waiting for the shard to go into search idle state.
@elasticsearchmachine 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.
This looks good. I left a comment about where to place these new stats and testing.
@@ -182,4 +200,27 @@ private void ensureNoPendingScheduledRefresh(ThreadPool threadPool) { | |||
barrier.arriveAndAwaitAdvance(); | |||
} | |||
|
|||
public void testSearchIdleStats() throws InterruptedException { |
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.
Maybe also add a yaml test to rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.stats
dir?
Just to verify that the new fields are included in the stats response
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.
I was thinking about that even if the stats api sued at shard level returns a lot of data that I can't actually check with match
. Also for search idle I can't check the values in the test...just that the fields exist.
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.
.just that the fields exist.
and that is what I think we should test for. We can't assert what actual values are there, just the existence of the new fields.
.prepareCreate(indexName) | ||
.setSettings( | ||
Settings.builder() | ||
.put(IndexSettings.INDEX_SEARCH_IDLE_AFTER.getKey(), searchIdleAfter + "s") |
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.
Maybe reduce this idle after to something like 100ms here? Otherwise it increases the time to run this test significantly.
@@ -211,6 +259,9 @@ static final class Fields { | |||
static final String PRIMARY = "primary"; | |||
static final String NODE = "node"; | |||
static final String RELOCATING_NODE = "relocating_node"; | |||
static final String SEARCH_IDLE = "search_idle"; | |||
static final String IS_SEARCH_IDLE = "is_idle"; |
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.
I'm not really happy with search_idle
object. Thinking more about this, maybe we should add these two fields to SearchStats
?
|
||
import java.util.concurrent.TimeUnit; | ||
|
||
public class SearchIdleStatsTests extends ESSingleNodeTestCase { |
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.
I think this either need to have a IT
suffix or be moved to server/src/test/java
?
@@ -316,6 +338,8 @@ public void add(SearchStats searchStats) { | |||
groupStats.get(entry.getKey()).add(entry.getValue()); | |||
} | |||
} | |||
isSearchIdle = searchStats.isSearchIdle; |
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.
If shards stats are collected in index or data stream level, this could hide shards that are search idle.
Maybe we should report sum or max idle time? Or maybe we should move this information back to ShardStats
?
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.
Left one comment, LGTM otherwise.
@@ -211,6 +257,8 @@ static final class Fields { | |||
static final String PRIMARY = "primary"; | |||
static final String NODE = "node"; | |||
static final String RELOCATING_NODE = "relocating_node"; | |||
static final String IS_SEARCH_IDLE = "is_search_idle"; |
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.
maybe just search_idle
instead of is_search_idle
? I think boolean fields don't usually get the is_
prefix. (see for example primary field)
This reverts commit f523caf.
This PR got merged after the update to transport versions and mistakenly introduced a usage of an existing transport version. In this case the |
Extend the Index Stats API to include information about shard idleness. To be more precise we include two pieces of info: * a boolean indicating if a shard is idle at the moment the API call takes place * a long value indicating the time in milliseconds the shard has been search idle since the last time it went into search idle state
Include search idle info to shard stats (#95740) Extend the Index Stats API to include information about shard idleness. To be more precise we include two pieces of info: * a boolean indicating if a shard is idle at the moment the API call takes place * a long value indicating the time in milliseconds the shard has been search idle since the last time it went into search idle state
Extend the Index Stats API to include information about shard idleness.
To be more precise we include two pieces of info:
Resolves #95727