Skip to content

Add age_in_millis to ILM Explain Response #128866

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

Conversation

gmjehovich
Copy link
Contributor

@gmjehovich gmjehovich commented Jun 3, 2025

This PR enhances the _ilm/explain API by adding an age_in_millis field to its response.

Previously, the index's "age" was only reported in a human-readable format (age: "1.97d").

This change introduces the age_in_millis field, providing the index's age as a precise millisecond value (e.g., age_in_millis: 170208000).

This new field is validated with corresponding unit and integration testing

Closes #103659

@gmjehovich gmjehovich requested a review from joegallo June 3, 2025 22:24
@gmjehovich gmjehovich self-assigned this Jun 3, 2025
@gmjehovich gmjehovich added >enhancement :Data Management/ILM+SLM Index and Snapshot lifecycle management Team:Data Management Meta label for data/management team Supportability Improve our (devs, SREs, support eng, users) ability to troubleshoot/self-service product better. labels Jun 3, 2025
@gmjehovich gmjehovich added the auto-backport Automatically create backport pull requests when merged label Jun 9, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @gmjehovich, I've created a changelog YAML for you.

@elasticsearchmachine
Copy link
Collaborator

Hi @gmjehovich, I've updated the changelog YAML for you.

@gmjehovich gmjehovich marked this pull request as ready for review June 9, 2025 19:01
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

Copy link
Contributor

@joegallo joegallo left a comment

Choose a reason for hiding this comment

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

Two tiny comments:

1.) There's a comment block ahead that notes that the array of arguments coming into the parsing constructor ignores a few fields -- since this one will be ignored, we should add it to that comment. Look for this section:

            // a[13] == "age"
            // a[20] == "time_since_index_creation"
            // <--- your new thing would go here

2.) You can DRY the getAge(nowSupplier) call and pull it out as a local final var -- I realize this is pracitically inconsequential, but it allows the world to know I was here. 😉

Other than that, LGTM!

@joegallo
Copy link
Contributor

For the record, I was really flummoxed by how we'd handle disparity between the writer and the reader with a synthetic field like the age_in_millis, but then of course it's just received by the constructor and ignored (which, you know, simple enough). But having a comment to indicate that you know you're ignoring it makes it a little clearer that this wasn't just an oversight.

@gmjehovich gmjehovich merged commit 4164058 into elastic:main Jul 1, 2025
32 checks passed
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jul 2, 2025
* Add age_in_millis to ILM Explain Response

* Fix: Declare age_in_millis in ILM Explain Response Parser

* Add unit tests for age_in_millis field in IndexLifecycleExplainResponse

* Update docs/changelog/128866.yaml

* Update docs/changelog/128866.yaml

* Update IndexLifecycleExplainResponse.java

Fix comments; follow DRY for getAge(nowSupplier) call in IndexLifecycleExplainResponse

---------

Co-authored-by: Joe Gallo <[email protected]>
mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jul 3, 2025
* Add age_in_millis to ILM Explain Response

* Fix: Declare age_in_millis in ILM Explain Response Parser

* Add unit tests for age_in_millis field in IndexLifecycleExplainResponse

* Update docs/changelog/128866.yaml

* Update docs/changelog/128866.yaml

* Update IndexLifecycleExplainResponse.java

Fix comments; follow DRY for getAge(nowSupplier) call in IndexLifecycleExplainResponse

---------

Co-authored-by: Joe Gallo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/ILM+SLM Index and Snapshot lifecycle management >enhancement Supportability Improve our (devs, SREs, support eng, users) ability to troubleshoot/self-service product better. Team:Data Management Meta label for data/management team v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[API][ILM Explain] Report age in milliseconds
3 participants