-
Notifications
You must be signed in to change notification settings - Fork 8.5k
[Background search] Return error state when there are no searches #241411
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
Conversation
dc32bc8 to
1534875
Compare
| // A session should is considered "new" for the first 30 seconds after creation. We need some arbitrary value here | ||
| // because if a sessions stays for too long with no searches assigned to it something happened and we should mark it as error. | ||
| // Some examples of possible issues: the browser is closed or in another tab the search requests are canceled. | ||
| const NEW_SESSION_THRESHOLD_SECONDS = 30; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
30 seconds is a totally arbitrary number, happy to change it to something else if it doesn't sound good
|
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1534875 to
b675544
Compare
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
cc @AlexGPlay |
|
Starting backport for target branches: 9.2 |
…astic#241411) ## Summary Closes elastic#240887 Right now if a background search has 0 searches it stays in the "In progress" state but that's not correct. If no searches are added to the background search it means that something went wrong. With this PR we will label as error the search sessions if they have 0 searches after being created for 30 seconds. | Before | After | |--------|------| | <img width="716" height="89" alt="image" src="https://github.com/user-attachments/assets/1bb4b60a-20d3-488e-b4e9-9fd8cd4d0b24" /> | <img width="675" height="88" alt="image" src="https://github.com/user-attachments/assets/4befb6c0-5edb-4229-9919-e2b76ae90731" /> | ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels. (cherry picked from commit 131f1a0)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…es (#241411) (#241932) # Backport This will backport the following commits from `main` to `9.2`: - [[Background search] Return error state when there are no searches (#241411)](#241411) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Alejandro García Parrondo","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-11-05T10:10:43Z","message":"[Background search] Return error state when there are no searches (#241411)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/240887\n\nRight now if a background search has 0 searches it stays in the \"In\nprogress\" state but that's not correct. If no searches are added to the\nbackground search it means that something went wrong. With this PR we\nwill label as error the search sessions if they have 0 searches after\nbeing created for 30 seconds.\n\n| Before | After |\n|--------|------|\n| <img width=\"716\" height=\"89\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/1bb4b60a-20d3-488e-b4e9-9fd8cd4d0b24\"\n/> | <img width=\"675\" height=\"88\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/4befb6c0-5edb-4229-9919-e2b76ae90731\"\n/> |\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [x] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.","sha":"131f1a002666e1a3065dacc30754a519bce7a2cc","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Project:AsyncSearch","Team:DataDiscovery","backport:version","v9.3.0","v9.2.1"],"title":"[Background search] Return error state when there are no searches","number":241411,"url":"https://github.com/elastic/kibana/pull/241411","mergeCommit":{"message":"[Background search] Return error state when there are no searches (#241411)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/240887\n\nRight now if a background search has 0 searches it stays in the \"In\nprogress\" state but that's not correct. If no searches are added to the\nbackground search it means that something went wrong. With this PR we\nwill label as error the search sessions if they have 0 searches after\nbeing created for 30 seconds.\n\n| Before | After |\n|--------|------|\n| <img width=\"716\" height=\"89\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/1bb4b60a-20d3-488e-b4e9-9fd8cd4d0b24\"\n/> | <img width=\"675\" height=\"88\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/4befb6c0-5edb-4229-9919-e2b76ae90731\"\n/> |\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [x] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.","sha":"131f1a002666e1a3065dacc30754a519bce7a2cc"}},"sourceBranch":"main","suggestedTargetBranches":["9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/241411","number":241411,"mergeCommit":{"message":"[Background search] Return error state when there are no searches (#241411)\n\n## Summary\n\nCloses https://github.com/elastic/kibana/issues/240887\n\nRight now if a background search has 0 searches it stays in the \"In\nprogress\" state but that's not correct. If no searches are added to the\nbackground search it means that something went wrong. With this PR we\nwill label as error the search sessions if they have 0 searches after\nbeing created for 30 seconds.\n\n| Before | After |\n|--------|------|\n| <img width=\"716\" height=\"89\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/1bb4b60a-20d3-488e-b4e9-9fd8cd4d0b24\"\n/> | <img width=\"675\" height=\"88\" alt=\"image\"\nsrc=\"https://github.com/user-attachments/assets/4befb6c0-5edb-4229-9919-e2b76ae90731\"\n/> |\n\n\n### Checklist\n\nCheck the PR satisfies following conditions. \n\nReviewers should verify this PR satisfies this list as well.\n\n- [x] [Unit or functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere updated or added to match the most common scenarios\n- [x] The PR description includes the appropriate Release Notes section,\nand the correct `release_note:*` label is applied per the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\n- [x] Review the [backport\nguidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)\nand apply applicable `backport:*` labels.","sha":"131f1a002666e1a3065dacc30754a519bce7a2cc"}},{"branch":"9.2","label":"v9.2.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Alejandro García Parrondo <[email protected]>
…astic#241411) ## Summary Closes elastic#240887 Right now if a background search has 0 searches it stays in the "In progress" state but that's not correct. If no searches are added to the background search it means that something went wrong. With this PR we will label as error the search sessions if they have 0 searches after being created for 30 seconds. | Before | After | |--------|------| | <img width="716" height="89" alt="image" src="https://github.com/user-attachments/assets/1bb4b60a-20d3-488e-b4e9-9fd8cd4d0b24" /> | <img width="675" height="88" alt="image" src="https://github.com/user-attachments/assets/4befb6c0-5edb-4229-9919-e2b76ae90731" /> | ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels.
…astic#241411) ## Summary Closes elastic#240887 Right now if a background search has 0 searches it stays in the "In progress" state but that's not correct. If no searches are added to the background search it means that something went wrong. With this PR we will label as error the search sessions if they have 0 searches after being created for 30 seconds. | Before | After | |--------|------| | <img width="716" height="89" alt="image" src="https://github.com/user-attachments/assets/1bb4b60a-20d3-488e-b4e9-9fd8cd4d0b24" /> | <img width="675" height="88" alt="image" src="https://github.com/user-attachments/assets/4befb6c0-5edb-4229-9919-e2b76ae90731" /> | ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [x] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) - [x] Review the [backport guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing) and apply applicable `backport:*` labels.

Summary
Closes #240887
Right now if a background search has 0 searches it stays in the "In progress" state but that's not correct. If no searches are added to the background search it means that something went wrong. With this PR we will label as error the search sessions if they have 0 searches after being created for 30 seconds.
Checklist
Check the PR satisfies following conditions.
Reviewers should verify this PR satisfies this list as well.
release_note:*label is applied per the guidelinesbackport:*labels.