[Console] Remove odd retry logic and add ES host selector#229574
[Console] Remove odd retry logic and add ES host selector#229574sabarasaba merged 6 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/kibana-management (Team:Kibana Management) |
|
@elasticmachine merge upstream |
ElenaStoeva
left a comment
There was a problem hiding this comment.
Thanks for fixing this long-standing issue @sabarasaba! Tested and worked fine, left a few comments about the code changes.
| const [availableHosts, setAvailableHosts] = useState<string[]>([]); | ||
|
|
||
| // Get available hosts from esHostService after it's initialized | ||
| useEffect(() => { |
There was a problem hiding this comment.
It seems this causes infinite rerendering, probably because when setSelectedHost() is called, selectedHost is changed and so this is run again. We could maybe use props.settings.selectedHost instead of selectedHost?
Untitled.mov
There was a problem hiding this comment.
interesting! It seems that the re-rendering issue was already there in the original code, turns out that the debouncedSaveSettings is recreated on every render, and since it's in the dependency array of the other useEffect it causes the effect to run on every render, which triggers another render 🤯 Fixed it with 857c340
There was a problem hiding this comment.
Nice, thanks for fixing it!
| value: host, | ||
| inputDisplay: host, | ||
| }))} | ||
| valueOfSelected={selectedHost || (availableHosts.length > 0 ? availableHosts[0] : '')} |
There was a problem hiding this comment.
If availableHosts is empty, is it worth displaying this whole field?
There was a problem hiding this comment.
Available hosts will always have at least one entry, so I still think its worth to show it in order to be more explicit about it (even though its disabled if there is only one option) as it makes it more explicit to the users what it is actually hitting
There was a problem hiding this comment.
Ah okay, I see your point. 👍
💚 Build Succeeded
Metrics [docs]Async chunks
Page load bundle
Unknown metric groupsESLint disabled line counts
Total ESLint disabled count
History
cc @sabarasaba |
ElenaStoeva
left a comment
There was a problem hiding this comment.
Thanks for addressing my feedback! Latest lgtm.
|
Starting backport for target branches: 9.1 |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
) (#230052) # Backport This will backport the following commits from `main` to `9.1`: - [[Console] Remove odd retry logic and add ES host selector (#229574)](#229574) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Ignacio Rivas","email":"rivasign@gmail.com"},"sourceCommit":{"committedDate":"2025-07-31T10:17:31Z","message":"[Console] Remove odd retry logic and add ES host selector (#229574)","sha":"fedd325d7fe1ce702ac57ae8ed0b133a05bc9b9d","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Feature:Console","Team:Kibana Management","backport:prev-minor","v9.2.0"],"title":"[Console] Remove odd retry logic and add ES host selector","number":229574,"url":"https://github.com/elastic/kibana/pull/229574","mergeCommit":{"message":"[Console] Remove odd retry logic and add ES host selector (#229574)","sha":"fedd325d7fe1ce702ac57ae8ed0b133a05bc9b9d"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/229574","number":229574,"mergeCommit":{"message":"[Console] Remove odd retry logic and add ES host selector (#229574)","sha":"fedd325d7fe1ce702ac57ae8ed0b133a05bc9b9d"}}]}] BACKPORT--> Co-authored-by: Ignacio Rivas <rivasign@gmail.com>
Fixes #160380 and #147457
Summary
This PR fixes a critical bug in Console where request body streams were being consumed during host retries, causing subsequent requests to be sent without their body content. The fix removes the automatic retry logic and replaces it with explicit host selection.
By removing the retry logic and giving users explicit host selection, the behavior of console becomes predictable and transparent: users know exactly which host their requests are hitting, can easily switch hosts if one is down, and never risk silent data loss during failed requests. This trades automatic fallback for reliability and user control, which I think is more appropriate for a developer tool where understanding exactly what is happening is crucial.
Release note
Fixed an issue in Console where request bodies were lost during automatic host retries. Console now uses explicit host selection instead of retrying failed hosts, ensuring predictable behavior and preventing silent request failures.
Testing
Add
elasticsearch.hosts: ["http://localhost:9200", "http://localhost:9202", "http://localhost:9201"]to yourconfig/kibana.ymland fire up es/kibana. You should be able to ping :9200 which should be your local ES instance without a problem, but the other ports should be for nonexistent instances and should fail instead.