Skip to content

Conversation

@talevy
Copy link
Contributor

@talevy talevy commented Sep 7, 2018

Adds the currently executing policy-name, its version, and its modified date to the explain api
for every executing/managed index

TODO:

  • find right place for integration test catching a phase mid-execution (so the info is rendered)
    • decided that the right place is the IndexLifecycleIT Client tests. two birds with one stone.
  • update HLRC code to reflect server changes

@talevy talevy added the :Data Management/ILM+SLM Index and Snapshot lifecycle management label Sep 7, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@talevy talevy added the WIP label Sep 7, 2018
@talevy talevy requested a review from colings86 September 7, 2018 01:31
@talevy
Copy link
Contributor Author

talevy commented Sep 7, 2018

Hey @colings86, there is some more work to be done here, but I think there is enough to give a fair representation of the implementation direction. I'd appreciate the early feedback pending availability. It can wait until I finish off the TODOs too

Copy link
Contributor

@colings86 colings86 left a comment

Choose a reason for hiding this comment

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

@talevy I left a comment but I think this is good so far.

private static final ParseField PHASE_DEFINITION_FIELD = new ParseField("phase_definition");
private static final ParseField VERSION_FIELD = new ParseField("version");
private static final ParseField MODIFIED_DATE_FIELD = new ParseField("modified_date");
private static final ParseField MODIFIED_DATE_STRING_FIELD = new ParseField("modified_date_string");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we switch between the string and the millis representation fo the modified date using the human flag like the explain API already does? That way we can just have one modified_date field in the output? Also the parser will not need to worry about the string version in this case since the client it will never set the human flag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. I forgot this was an option until I noticed that is happening elsewhere in ILM objects. I will update accordingly

@talevy talevy requested review from dakrone and gwbrown September 13, 2018 19:05
@talevy talevy removed the WIP label Sep 13, 2018
Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

Thanks for doing this @talevy, I left some comments


@Override
public String toString() {
return Strings.toString(this, true, true);
Copy link
Member

Choose a reason for hiding this comment

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

Can you make this non-pretty, it's always weird when you log things and then end up being multi-line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

true, log lines are unfortunate, but comparing test assertions are. since one is in production, logging concerns win 👍

builder.field(POLICY_NAME_FIELD.getPreferredName(), policyName);
builder.field(PHASE_DEFINITION_FIELD.getPreferredName(), phase);
builder.field(VERSION_FIELD.getPreferredName(), version);
if (builder.humanReadable()) {
Copy link
Member

Choose a reason for hiding this comment

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

For human readable-ness, an additional field should be added, we shouldn't replace the field with a human readable version.

You should be able to do

builder.timeField("modified_millis", "modified", modifiedDate);

(replacing the field names with the fields we want to use)

and then you don't have to check the human readable flag yourself


@Override
public String toString() {
return Strings.toString(this, true, true);
Copy link
Member

Choose a reason for hiding this comment

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

Same here about multi-line toString methods

builder.field(POLICY_NAME_FIELD.getPreferredName(), policyName);
builder.field(PHASE_DEFINITION_FIELD.getPreferredName(), phase);
builder.field(VERSION_FIELD.getPreferredName(), version);
if (builder.humanReadable()) {
Copy link
Member

Choose a reason for hiding this comment

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

Here again I think we should use builder.timeField to handle this

DeprecationHandler.THROW_UNSUPPORTED_OPERATION, phaseDef)) {
phaseExecutionInfo = PhaseExecutionInfo.parse(parser, currentPhase);
} catch (IOException e) {
logger.error("failed to parse [" + LifecycleSettings.LIFECYCLE_PHASE_DEFINITION + "] for index [" + index + "]", e);
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should swallow this error here, I think the request should error out also

@talevy talevy requested a review from dakrone September 17, 2018 21:57
Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

LGTM, left a super minor comment

@talevy
Copy link
Contributor Author

talevy commented Sep 17, 2018

thanks for the review @dakrone!

@talevy talevy merged commit 94a66c5 into elastic:index-lifecycle Sep 18, 2018
@talevy talevy deleted the ilm-explain-more branch September 18, 2018 00:00
talevy added a commit that referenced this pull request Sep 18, 2018
adds a section for phase execution to the Explain API.

This contains

- phase definition
- policy name
- policy version
- modified date
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants