Skip to content
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

File settings health indicator #3173

Merged
merged 3 commits into from
Nov 22, 2024
Merged

Conversation

prdoyle
Copy link
Contributor

@prdoyle prdoyle commented Nov 22, 2024

Describes the health indicator added in elastic/elasticsearch#117081.

@prdoyle prdoyle self-assigned this Nov 22, 2024
Copy link
Contributor

Following you can find the validation results for the API you have changed.

API Status Request Response
health_report 🟢 4/4 4/4

You can validate this API yourself by using the make validate target.

@dakrone
Copy link
Member

dakrone commented Nov 22, 2024

This looks suspiciously small, I seem to recall in the past these included the generated outputs in git. Did you run the commands in https://github.com/elastic/elasticsearch-specification?tab=readme-ov-file#how-to-generate-the-json-representation after adding this?

@prdoyle
Copy link
Contributor Author

prdoyle commented Nov 22, 2024

No I did not do that. Thanks for the pointer!

Copy link
Contributor

Following you can find the validation results for the API you have changed.

API Status Request Response
health_report 🟢 4/4 4/4

You can validate this API yourself by using the make validate target.

@prdoyle
Copy link
Contributor Author

prdoyle commented Nov 22, 2024

One thing that puzzles me. Most indicators use HealthIndicatorDetails.EMPTY under certain circumstances, which corresponds to JSON {}, yet they seem to declare the detail fields to be required (not optional). I'm not sure how this works, but I followed the same pattern.

@dakrone
Copy link
Member

dakrone commented Nov 22, 2024

they seem to declare the detail fields to be required (not optional)

This sounds like a bug to me. The details field should be optional because hitting GET /_health_report?verbose=false does not include the details subobject. We should fix this. /cc @pquentin so that you are aware of this.

@prdoyle
Copy link
Contributor Author

prdoyle commented Nov 22, 2024

This sounds like a bug to me. The details field should be optional because hitting GET /_health_report?verbose=false does not include the details subobject. We should fix this. /cc @pquentin so that you are aware of this.

To be clear, the details field itself is optional; but the fields of the details object are not optional despite the fact that HealthIndicatorDetails.EMPTY is serialized as {} with no fields, according to this code.

@prdoyle
Copy link
Contributor Author

prdoyle commented Nov 22, 2024

I think I figured it out. According to this code, we skip the details field if the value equals HealthIndicatorDetails.EMPTY. This means the {} value is ignored and the field is skipped.

Given this, I think my change here is actually fine. FYI @pquentin

I will say: I agree with @dakrone that this sounds like a bug, which isn't ideal.

Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM.

Indeed, if details is either absent or contains the full details, then this change is correct. Thank you @prdoyle for the pull request and @dakrone for the review.

@pquentin pquentin merged commit b4ee38a into main Nov 22, 2024
7 checks passed
@pquentin pquentin deleted the file-settings-health-indicator branch November 22, 2024 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants