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

[ILM] Support max primary shard size rollover field #96545

Merged

Conversation

jloleysens
Copy link
Contributor

@jloleysens jloleysens commented Apr 8, 2021

Summary

Fixes #92037

Screenshots

Screenshot 2021-04-15 at 10 50 07

Screenshot 2021-04-15 at 10 50 25

How to test

  • Start Kibana and ES yarn es snapshot; yarn start
  • Go to the Index Lifeccycle Management subsection of the Management section
  • Create or edit a policy
  • Expand the Hot Phase advanced settings
  • Ensure "use default rollover" is not selected
  • Add a value to the "Maximum index size" field
  • Check the deprecation message is showing
  • Check that the "Maximum primary shard size" field is being added to the policy if there is a value, check that it is being removed if there is no value

For copy review

  • L26 of x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/components/max_index_size_field.tsx
  • L111 x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx

Release note

The ILM policy configuration UI now supports the new maximum primary index size field in the rollover action.

Checklist

@jloleysens jloleysens added release_note:enhancement Feature:ILM v8.0.0 Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.13.0 labels Apr 8, 2021
@jloleysens jloleysens requested a review from sebelga April 8, 2021 10:31
- fixed behaviour to show missing value for rollover
- updated jest snapshots
@jloleysens jloleysens requested a review from mdefazio April 12, 2021 12:21
@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

@jloleysens jloleysens marked this pull request as ready for review April 12, 2021 14:14
@jloleysens jloleysens requested review from a team as code owners April 12, 2021 14:14
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

Copy link
Contributor

@sebelga sebelga left a comment

Choose a reason for hiding this comment

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

Great work @jloleysens ! I tested locally and works as expected.

</EuiFlexItem>
</EuiFlexGroup>

<MaxPrimaryShardSizeField />
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for splitting it up in separate components!

(validation) => validation.code === ROLLOVER_VALUE_REQUIRED_VALIDATION_CODE
)
);
}, [form, formData]);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: to be slightly more precise and avoid triggering the effect whenever the form state changes you could just provide the getFields handler in the dependency and not the complete form object.

}
};

export const integerValidator: ValidationFunc<FormInternal, string, string> = (arg) => {
export const integerValidator: ValidationFunc<any, string, string> = (arg) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see why you've added the any here. I solved this kind of problem by not typing the schema

// schema.ts (L136)
export const getSchema = (isCloudEnabled: boolean): FormSchema => ({

So I could correctly type here the validation.

…ax_primary_shard_size

* 'master' of github.com:elastic/kibana: (99 commits)
  added missing optional chain for bracket notation (elastic#96939)
  [Discover][DocViewer] Fix toggle columns from doc viewer table tab (elastic#95748)
  [TSVB] Fix per-request caching of index patterns (elastic#97043)
  [Datatable] Fix filter cell flakiness (elastic#96934)
  Unskip heatmap suite and fixes flakiness (elastic#96941)
  [Fleet] Improve performance of data stream API (elastic#97058)
  [ML] Data Frame Analytics: remove beta badge (elastic#96977)
  [App Search] Migrate expanded rows for meta engines table in Engines Overview (elastic#96251)
  Instances latency distribution chart tooltips and axis fixes (elastic#95577)
  [Monitoring] Using primary average shard size (elastic#96177)
  [Workplace Search] Hide Kibana chrome on 3rd party connector redirects (elastic#97028)
  ## [Security Solution] Fixes `Exit full screen` and `Copy to cliboard` styling issues (elastic#96676)
  Index pattern field editor - Add warning on name or type change (elastic#95528)
  [App Search] Add small engine breadcrumb utility helper (elastic#96917)
  Copy esArchiver commands from ./reassign.ts to fix tests (elastic#97012)
  [Security Solution][Detections] Updates MITRE Tactics, Techniques, and Subtechniques for 7.13 (elastic#97011)
  Index patterns server - throw correct error on field caps 404 (elastic#95879)
  Use `EuiThemeProvider` in lists plugin tests and stories (elastic#96129)
  [npm] upgrade caniuse database (elastic#97002)
  chore(NA): moving @kbn/apm-utils into bazel (elastic#96227)
  ...

# Conflicts:
#	x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/serialization/policy_serialization.test.ts
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/schema.ts
@@ -0,0 +1,13 @@
.ilmFieldDeprecationWarning {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'll take a look locally, but these negative margins have me wondering how well this will hold up over time/cross-browser/responsively. Perhaps we could avoid floating the icon to the left of the input by using a prepend or append? https://elastic.github.io/eui/#/forms/form-controls#prepend-and-append

Copy link
Contributor

Choose a reason for hiding this comment

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

After checking this out a bit more, I do think we should take a different approach here. At smaller sizes (granted its not the most common use case) the warning is not visible. Further, since this triggers for any value, then we should just show it by default / all the time. The prepend or append approach achieves this result.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @ryankeairns ! Thanks for the review and checking out the code locally, happy to make adjustments per your recommendations.

Further, since this triggers for any value, then we should just show it by default / all the time

I was considering this in the initial implementation, but I was concerned that always having the yellow alert logo visible would draw the users attention where it may not be needed. I'd be curious to get your thoughts on this:

Screenshot 2021-04-14 at 15 44 36

We could also show the prepend when the user enters a value since I don't think the pop in effect is particularly disorientating in this case:

popin-max-index-size

CC @mdefazio

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for trying this out. I'll defer to DeFazio on the final adjustments.

Copy link
Contributor

@ryankeairns ryankeairns left a comment

Choose a reason for hiding this comment

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

See comments below about handling the warning/icon in a different way. Thanks

@@ -0,0 +1,13 @@
.ilmFieldDeprecationWarning {
Copy link
Contributor

Choose a reason for hiding this comment

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

After checking this out a bit more, I do think we should take a different approach here. At smaller sizes (granted its not the most common use case) the warning is not visible. Further, since this triggers for any value, then we should just show it by default / all the time. The prepend or append approach achieves this result.

@cjcenizal
Copy link
Contributor

@jloleysens @mdefazio @ryankeairns Would this use case be aided by elastic/eui#1200, which requests support for warning and success styles for form row error messages?

Copy link
Contributor

@debadair debadair left a comment

Choose a reason for hiding this comment

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

Just a couple minor changes. Otherwise LGTM.

'xpack.indexLifecycleMgmt.hotPhase.maximumIndexSizeDeprecationMessage',
{
defaultMessage:
'Maximum index size is deprecated and will be removed in future versions of the Elastic stack. Please use maximum primary shard size instead.',
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
'Maximum index size is deprecated and will be removed in future versions of the Elastic stack. Please use maximum primary shard size instead.',
'Maximum index size is deprecated and will be removed in a future version. Use maximum primary shard size instead.',

@@ -107,7 +108,7 @@ export const HotPhase: FunctionComponent = () => {
<EuiSpacer size="s" />
<FormattedMessage
id="xpack.indexLifecycleMgmt.editPolicy.hotPhase.rolloverDefaultsTipContent"
defaultMessage="Rollover when an index is 30 days old or reaches 50 gigabytes."
defaultMessage="Rollover when an index is 30 days old or the primary shard reaches 50 gigabytes."
Copy link
Contributor

Choose a reason for hiding this comment

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

An index can have multiple primary shards.

Suggested change
defaultMessage="Rollover when an index is 30 days old or the primary shard reaches 50 gigabytes."
defaultMessage="Roll over when an index is 30 days old or any primary shard reaches 50 gigabytes."

@mdefazio
Copy link
Contributor

Apologies for the slow response on this. We took this opportunity to go through this as an example PR with @dborodyansky .

@cjcenizal I think that approach could definitely work. We'll have to see if there are any spacing / length issues because these are 2 form fields next to each, so would the help text from one form field be able to extend under the next one (maybe i'm missing an easy implementation here, but this sounds difficult). So we'd likely have a line break in this text and it take up a lot of space. Maybe that's ok though.

If we go with the prepend approach, a few thoughts:

  1. I'm inclined to say that keeping the prepend there always isn't a big deal. But I suppose it depends how obvious we want it to be when they fill it in.
  2. I don't think the yellow warning icon would pass a contrast test on the gray background. So I'd suggest just using the text color. If we decide to only show it on change in the value then this will still be obvious enough IMO.

I'm showing the example if we keep the icon persistent
image


A few other things that may or may not be relevant for this PR, but wanted to note:

  1. I think the gutter width on the form rows is a bit far and so the 'gigabytes' feels like a different field as opposed to related to the number input.
  2. There's some slight misalignment with the form fields that I think just adding alignItems: 'flexEnd might fix (since one field has a label and the other doesn't).

@cjcenizal
Copy link
Contributor

Another option would be to just change the label to Maximum index size (deprecated). We could even add a tooltip to the label to guide people to use Maximum primary shard size instead. Has the benefit of not needing any new design patterns or states.

- implmented always showing the warning icon and updated the color
- cleaned up test helpers
  by reducing the gutter size before defazios feedback
- fixed alignment issue between numeric rollover inputs and their
  unit select field by adding flex-end styling to the groups
@jloleysens
Copy link
Contributor Author

@mdefazio @ryankeairns @debadair @cjcenizal

Thank you all for the great feedback! I believe this PR is ready for another round of review.

After some thought, I landed on the following approach:

  • Always show the alert icon (not just when a value is present)
  • Use a higher contrast, default color

This approach reduces code changes (we don't have additional states to track) so if we ever want to change this it will be really simple. Additionally, I opted for the prepended icon tip instead of adding (deprecated) (?) to the field label as this looks more polished.

(Screenshots with flex align and gutter sizing adjustments)

Screenshot 2021-04-15 at 10 50 07

Screenshot 2021-04-15 at 10 50 25

@sebelga not sure whether you want to go over the code again, I'm quite confident we have not introduced regressions since your last review since conditional logic has been removed.

@sebelga
Copy link
Contributor

sebelga commented Apr 15, 2021

Reviewed your commits from yesterday and today and LGTM! 👍

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
indexLifecycleManagement 200 206 +6

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
indexLifecycleManagement 241.9KB 246.2KB +4.4KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
indexLifecycleManagement 50.1KB 50.1KB +14.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@mdefazio mdefazio left a comment

Choose a reason for hiding this comment

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

LGTM!

@jloleysens
Copy link
Contributor Author

I am going to go ahead and merge this PR since I think we have addressed all outstanding questions regarding the deprecated field (including requested copy changes).

@jloleysens jloleysens merged commit 5ecf098 into elastic:master Apr 15, 2021
@jloleysens jloleysens deleted the ilm/support-max_primary_shard_size branch April 15, 2021 16:02
jloleysens added a commit to jloleysens/kibana that referenced this pull request Apr 15, 2021
* added max primary shard size rollover field

* large-ish refactor of the hot phase component to move the rollover fields to their own components

* added comment

* address i18n issue

* - fixed jest tests
- fixed behaviour to show missing value for rollover
- updated jest snapshots

* added field deprecation component

* added test for whether deprecation icon is visible

* remove unused import, remove type generic from FormSchema

* fixed getting "getFields" from incorrect object

* wip!!!

* - removed FieldDeprecationWarning component and associated tests
- implmented always showing the warning icon and updated the color
- cleaned up test helpers

* - more tightly grouped the numeric inputs with their unit selects
  by reducing the gutter size before defazios feedback
- fixed alignment issue between numeric rollover inputs and their
  unit select field by adding flex-end styling to the groups

Co-authored-by: Kibana Machine <[email protected]>
jloleysens added a commit that referenced this pull request Apr 15, 2021
* added max primary shard size rollover field

* large-ish refactor of the hot phase component to move the rollover fields to their own components

* added comment

* address i18n issue

* - fixed jest tests
- fixed behaviour to show missing value for rollover
- updated jest snapshots

* added field deprecation component

* added test for whether deprecation icon is visible

* remove unused import, remove type generic from FormSchema

* fixed getting "getFields" from incorrect object

* wip!!!

* - removed FieldDeprecationWarning component and associated tests
- implmented always showing the warning icon and updated the color
- cleaned up test helpers

* - more tightly grouped the numeric inputs with their unit selects
  by reducing the gutter size before defazios feedback
- fixed alignment issue between numeric rollover inputs and their
  unit select field by adding flex-end styling to the groups

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ILM release_note:enhancement Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ILM] Add support for max_primary_shard_size option
8 participants