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

[Index Management] [Serverless] Error when editing data stream retention #196331

Closed
alisonelizabeth opened this issue Oct 15, 2024 · 2 comments · Fixed by #196524
Closed

[Index Management] [Serverless] Error when editing data stream retention #196331

alisonelizabeth opened this issue Oct 15, 2024 · 2 comments · Fixed by #196524
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Index Management Index and index templates UI Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more

Comments

@alisonelizabeth
Copy link
Contributor

Describe the bug:
Endless spinner shown when attempting to edit retention at the data stream level. Error in browser console.

Steps to reproduce:

  1. Create a Security serverless project
  2. Navigate to Kibana, create a data stream using Dev Tools.
PUT _index_template/ds
{
  "index_patterns": ["ds"],
  "data_stream": {}
}

POST ds/_doc
{
  "@timestamp": "2020-01-27"
}
  1. Navigate to Index Management. Find the data stream and select it --> Click "Manage" --> Click "Edit data retention"
  2. Disable the toggle "Keep data up to maximum retention period"
  3. Note endless spinner and error in browser Console.

Expected behavior:
I would expect to be able to add a custom retention value as long is it does not exceed the max.

Screenshots (if relevant):
Image

Errors in browser console (if relevant):

indexManagement.chunk.0.js:3 Uncaught (in promise) Error: Unknown unit: 
    at $n (indexManagement.chunk.0.js:3:409989)
    at validator (indexManagement.chunk.0.js:3:410441)
    at esUiShared.plugin.js:1:4805
    at esUiShared.plugin.js:1:4993
    at Object.validate (esUiShared.plugin.js:1:5381)
    at esUiShared.plugin.js:1:13631
    at Array.map (<anonymous>)
    at Object.validateFields (esUiShared.plugin.js:1:13621)
    at indexManagement.chunk.0.js:3:413816
    at Xc (kbn-ui-shared-deps-npm.dll.js:429:106059)
$n @ indexManagement.chunk.0.js:3
validator @ indexManagement.chunk.0.js:3
(anonymous) @ esUiShared.plugin.js:1
(anonymous) @ esUiShared.plugin.js:1
(anonymous) @ esUiShared.plugin.js:1
(anonymous) @ esUiShared.plugin.js:1
(anonymous) @ esUiShared.plugin.js:1
(anonymous) @ indexManagement.chunk.0.js:3
Xc @ kbn-ui-shared-deps-npm.dll.js:429
(anonymous) @ kbn-ui-shared-deps-npm.dll.js:437
$o @ kbn-ui-shared-deps-npm.dll.js:429
Uc @ kbn-ui-shared-deps-npm.dll.js:429
xc @ kbn-ui-shared-deps-npm.dll.js:429
(anonymous) @ kbn-ui-shared-deps-npm.dll.js:429
(anonymous) @ kbn-ui-shared-deps-npm.dll.js:437
$o @ kbn-ui-shared-deps-npm.dll.js:429
Qo @ kbn-ui-shared-deps-npm.dll.js:429
Zo @ kbn-ui-shared-deps-npm.dll.js:429
Xc @ kbn-ui-shared-deps-npm.dll.js:429
(anonymous) @ kbn-ui-shared-deps-npm.dll.js:437
$o @ kbn-ui-shared-deps-npm.dll.js:429
Uc @ kbn-ui-shared-deps-npm.dll.js:429
qe @ kbn-ui-shared-deps-npm.dll.js:429
Zt @ kbn-ui-shared-deps-npm.dll.js:429Understand this error
@alisonelizabeth alisonelizabeth added bug Fixes for quality problems that affect the customer experience Feature:Index Management Index and index templates UI Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more labels Oct 15, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-management (Team:Kibana Management)

@alisonelizabeth
Copy link
Contributor Author

At first glance, it would appear we are not accounting for the fact that data stream retention could not be defined (empty string) - related code.

Related PR: #193715

@ElenaStoeva ElenaStoeva self-assigned this Oct 15, 2024
ElenaStoeva added a commit that referenced this issue Oct 22, 2024
…96524)

Fixes #196331

## Summary

This PR fixes the bug in the Edit ds data retention modal where we were
comparing the max retention period with an undefined `value` (now the
comparison happens only if `value` is defined). Also, the PR makes the
data retention field get re-validated only when the time unit changes
(otherwise, when we switch off the toggle to enable to data retention
field, the field would get validated and would immediately show an error
"A data retention value is required." which is not great UX).

### How to test:
1. Start serverless ES with `yarn es serverless --projectType=security
-E data_streams.lifecycle.retention.max=200d` and kibana with `yarn
serverless-security`
2. Navigate to Kibana, create a data stream using Dev Tools:
```
PUT _index_template/ds
{
  "index_patterns": ["ds"],
  "data_stream": {}
}

POST ds/_doc
{
  "@timestamp": "2020-01-27"
}
```
3. Navigate to Index Management. Find the data stream and select it -->
Click "Manage" --> Click "Edit data retention"
4. Disable the toggle "Keep data up to maximum retention period"
5. Verify that the field is enabled correctly, there is not endless
spinner, and no console error.



https://github.com/user-attachments/assets/957e0869-ee23-46d9-8f20-134937f6f8cf

---------

Co-authored-by: Matthew Kime <[email protected]>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Oct 23, 2024
…astic#196524)

Fixes elastic#196331

## Summary

This PR fixes the bug in the Edit ds data retention modal where we were
comparing the max retention period with an undefined `value` (now the
comparison happens only if `value` is defined). Also, the PR makes the
data retention field get re-validated only when the time unit changes
(otherwise, when we switch off the toggle to enable to data retention
field, the field would get validated and would immediately show an error
"A data retention value is required." which is not great UX).

### How to test:
1. Start serverless ES with `yarn es serverless --projectType=security
-E data_streams.lifecycle.retention.max=200d` and kibana with `yarn
serverless-security`
2. Navigate to Kibana, create a data stream using Dev Tools:
```
PUT _index_template/ds
{
  "index_patterns": ["ds"],
  "data_stream": {}
}

POST ds/_doc
{
  "@timestamp": "2020-01-27"
}
```
3. Navigate to Index Management. Find the data stream and select it -->
Click "Manage" --> Click "Edit data retention"
4. Disable the toggle "Keep data up to maximum retention period"
5. Verify that the field is enabled correctly, there is not endless
spinner, and no console error.

https://github.com/user-attachments/assets/957e0869-ee23-46d9-8f20-134937f6f8cf

---------

Co-authored-by: Matthew Kime <[email protected]>
(cherry picked from commit d8fa996)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Index Management Index and index templates UI Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants