-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add item_count metric to field data cache stats API
#19174
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
base: main
Are you sure you want to change the base?
Add item_count metric to field data cache stats API
#19174
Conversation
|
❌ Gradle check result for b56cbf2: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
❌ Gradle check result for dce88a7: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
❌ Gradle check result for a297d35: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
❌ Gradle check result for 91cbbc9: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
❌ Gradle check result for f1d7105: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
❌ Gradle check result for 1dda2ac: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
@peteralfonsi I tried writing FieldDataStats also looks more clean now See if you reuse above and write it in a much better way! |
|
❌ Gradle check result for c9109fc: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
b8a9b2d to
6dd05d0
Compare
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
|
❌ Gradle check result for 6dd05d0: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
6dd05d0 to
664b92d
Compare
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
|
Fixed a horrifying git rebase disaster...should now contain only the necessary commits for the simpler implementation. |
|
❌ Gradle check result for e6cc019: null Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
server/src/main/java/org/opensearch/common/FieldCountStats.java
Outdated
Show resolved
Hide resolved
| FieldMemoryStats.toXContent( | ||
| builder, | ||
| fields, | ||
| FIELDS, | ||
| List.of(fieldMemorySizes, fieldItemCounts), | ||
| ORDERED_FIELD_LEVEL_API_RAW_KEYS, | ||
| ORDERED_FIELD_LEVEL_API_READABLE_KEYS | ||
| ); |
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.
We shouldn't be doing this. Using FieldMemoryStats logic for both itemCount and memory is what we don't want. As FieldMemoryStats is specific to memory related stats and shouldn't be used for other stuff.
Better to do it the original way?
if (fieldMemorySizes != null) {
fieldMemorySizes.toXContent(builder, FIELDS, MEMORY_SIZE_IN_BYTES, MEMORY_SIZE);
}
if (fieldItemCounts != null) {
fieldItemCounts.toXContent()
}
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.
No, like we talked about we can't use each individual object's XContent method separately, since the objects don't know about each other and then the resulting xcontent would be grouped like:

which is incorrect. So we need a static helper method which will group the output by field as the top level.
The logic in the helper method is not specific to FieldMemoryStats at all, it's just in that file since it seemed like a logical place to put it. I guess if we have them both extend from some base class it could go there instead.
server/src/main/java/org/opensearch/common/FieldMemoryStats.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Peter Alfonsi <petealft@amazon.com>
|
❌ Gradle check result for 7ac9b10: FAILURE Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change? |
|
This PR is stalled because it has been open for 30 days with no activity. |
Description
Adds an
item_countmetric to the existing_nodes/stats/indices/fielddataAPI. Like memory size, it can be aggregated by field by passing afielddata_fieldsparam listing the desired fields.Example API response for
curl -XGET "localhost:9200/_nodes/stats/indices/fielddata?pretty&fielddata_fields=text0,text2":Related Issues
Resolves #19173
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.