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

[Custom threshold][Logs Explorer] Issue with saving prefilled filters in custom threshold rule #183710

Closed
maryam-saeidi opened this issue May 17, 2024 · 1 comment · Fixed by #183900
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature: Custom threshold Observability custom threshold rule type Team:obs-ux-management Observability Management User Experience Team

Comments

@maryam-saeidi
Copy link
Member

Summary

We added the ability to pass filters to custom threshold and based on the decision in the related RFC, we decided to remove the $state parameters from the API. There is a bug in this logic that generates a validation error in case the user wants to save a rule without changing the prefilled filters:

image

Steps to reproduce

  • Go to the Logs Explorer page and add a filter
  • Create rule via Alerts > Create a rule on the top menu
  • Add a rule name and hit save, you will see the above-mentioned error in the UI

Acceptance criteria

  • Ensure the $state field is not saved in the searchConfiguration in any branch in the code
  • Add test
@maryam-saeidi maryam-saeidi added bug Fixes for quality problems that affect the customer experience Team:obs-ux-management Observability Management User Experience Team Feature: Custom threshold Observability custom threshold rule type labels May 17, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

@maryam-saeidi maryam-saeidi self-assigned this May 17, 2024
maryam-saeidi added a commit that referenced this issue May 23, 2024
…filters in the custom threshold rule on the Logs Explorer page (#183900)

Fixes #183710

## Summary

This PR fixes the issue of saving prefilled filters in the custom
threshold rule by using `getSearchConfiguration` every time the
serachConfiguration is saved in rule parameters. Now,
`getSearchConfiguration` does two things:
1. Ensure the query has the correct type (`Qurey`), or it will be set as
the default query.
2. Adjust filters by removing `$state` and only keeping `meta` and
`query`

Also, I adjusted the related type to exclude `$state`.

### How to test



https://github.com/elastic/kibana/assets/12370520/9d69e601-d021-4ae3-8baf-88286d3716fe
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue May 23, 2024
…filters in the custom threshold rule on the Logs Explorer page (elastic#183900)

Fixes elastic#183710

## Summary

This PR fixes the issue of saving prefilled filters in the custom
threshold rule by using `getSearchConfiguration` every time the
serachConfiguration is saved in rule parameters. Now,
`getSearchConfiguration` does two things:
1. Ensure the query has the correct type (`Qurey`), or it will be set as
the default query.
2. Adjust filters by removing `$state` and only keeping `meta` and
`query`

Also, I adjusted the related type to exclude `$state`.

### How to test

https://github.com/elastic/kibana/assets/12370520/9d69e601-d021-4ae3-8baf-88286d3716fe
(cherry picked from commit 4ccd47d)
kibanamachine added a commit that referenced this issue May 23, 2024
…filled filters in the custom threshold rule on the Logs Explorer page (#183900) (#184087)

# Backport

This will backport the following commits from `main` to `8.14`:
- [[Custom threshold][Logs Explorer] Fix an issue with saving prefilled
filters in the custom threshold rule on the Logs Explorer page
(#183900)](#183900)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Maryam
Saeidi","email":"maryam.saeidi@elastic.co"},"sourceCommit":{"committedDate":"2024-05-23T07:16:07Z","message":"[Custom
threshold][Logs Explorer] Fix an issue with saving prefilled filters in
the custom threshold rule on the Logs Explorer page (#183900)\n\nFixes
#183710\r\n\r\n## Summary\r\n\r\nThis PR fixes the issue of saving
prefilled filters in the custom\r\nthreshold rule by using
`getSearchConfiguration` every time the\r\nserachConfiguration is saved
in rule parameters. Now,\r\n`getSearchConfiguration` does two
things:\r\n1. Ensure the query has the correct type (`Qurey`), or it
will be set as\r\nthe default query.\r\n2. Adjust filters by removing
`$state` and only keeping `meta` and\r\n`query`\r\n\r\nAlso, I adjusted
the related type to exclude `$state`.\r\n\r\n### How to
test\r\n\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/12370520/9d69e601-d021-4ae3-8baf-88286d3716fe","sha":"4ccd47d90e7b812d0d405cdd906a8b775757c1a4","branchLabelMapping":{"^v8.15.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-management","v8.15.0"],"title":"[Custom
threshold][Logs Explorer] Fix an issue with saving prefilled filters in
the custom threshold rule on the Logs Explorer
page","number":183900,"url":"#183900
threshold][Logs Explorer] Fix an issue with saving prefilled filters in
the custom threshold rule on the Logs Explorer page (#183900)\n\nFixes
#183710\r\n\r\n## Summary\r\n\r\nThis PR fixes the issue of saving
prefilled filters in the custom\r\nthreshold rule by using
`getSearchConfiguration` every time the\r\nserachConfiguration is saved
in rule parameters. Now,\r\n`getSearchConfiguration` does two
things:\r\n1. Ensure the query has the correct type (`Qurey`), or it
will be set as\r\nthe default query.\r\n2. Adjust filters by removing
`$state` and only keeping `meta` and\r\n`query`\r\n\r\nAlso, I adjusted
the related type to exclude `$state`.\r\n\r\n### How to
test\r\n\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/12370520/9d69e601-d021-4ae3-8baf-88286d3716fe","sha":"4ccd47d90e7b812d0d405cdd906a8b775757c1a4"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.15.0","branchLabelMappingKey":"^v8.15.0$","isSourceBranch":true,"state":"MERGED","url":"#183900
threshold][Logs Explorer] Fix an issue with saving prefilled filters in
the custom threshold rule on the Logs Explorer page (#183900)\n\nFixes
#183710\r\n\r\n## Summary\r\n\r\nThis PR fixes the issue of saving
prefilled filters in the custom\r\nthreshold rule by using
`getSearchConfiguration` every time the\r\nserachConfiguration is saved
in rule parameters. Now,\r\n`getSearchConfiguration` does two
things:\r\n1. Ensure the query has the correct type (`Qurey`), or it
will be set as\r\nthe default query.\r\n2. Adjust filters by removing
`$state` and only keeping `meta` and\r\n`query`\r\n\r\nAlso, I adjusted
the related type to exclude `$state`.\r\n\r\n### How to
test\r\n\r\n\r\n\r\nhttps://github.com/elastic/kibana/assets/12370520/9d69e601-d021-4ae3-8baf-88286d3716fe","sha":"4ccd47d90e7b812d0d405cdd906a8b775757c1a4"}}]}]
BACKPORT-->

Co-authored-by: Maryam Saeidi <maryam.saeidi@elastic.co>
rshen91 pushed a commit to rshen91/kibana that referenced this issue May 30, 2024
…filters in the custom threshold rule on the Logs Explorer page (elastic#183900)

Fixes elastic#183710

## Summary

This PR fixes the issue of saving prefilled filters in the custom
threshold rule by using `getSearchConfiguration` every time the
serachConfiguration is saved in rule parameters. Now,
`getSearchConfiguration` does two things:
1. Ensure the query has the correct type (`Qurey`), or it will be set as
the default query.
2. Adjust filters by removing `$state` and only keeping `meta` and
`query`

Also, I adjusted the related type to exclude `$state`.

### How to test



https://github.com/elastic/kibana/assets/12370520/9d69e601-d021-4ae3-8baf-88286d3716fe
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: Custom threshold Observability custom threshold rule type Team:obs-ux-management Observability Management User Experience Team
Projects
None yet
2 participants