Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.x] [ML] Trained Models: Optimize trained models Kibana API (#200977)…
… (#203087) # Backport This will backport the following commits from `main` to `8.x`: - [[ML] Trained Models: Optimize trained models Kibana API (#200977)](#200977) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Dima Arnautov","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-04T18:50:18Z","message":"[ML] Trained Models: Optimize trained models Kibana API (#200977)\n\n## Summary\r\n\r\nCloses #191939 \r\nCloses https://github.com/elastic/kibana/issues/175220\r\n\r\nAdds various optimizations for the Trained Models page:\r\n\r\n---\r\n\r\n- Creates a new Kibana `/trained_models_list` endpoint responsible for\r\nfetching complete data for the Trained Model UI page, including\r\npipelines, indices and stats.\r\n\r\nBefore the Trained Models page required 3 endpoints. The new\r\n`trained_models_list` replaces them, reducing the overall latency.\r\n\r\n<img width=\"715\" alt=\"Screenshot 2024-12-02 at 16 18 32\"\r\nsrc=\"https://github.com/user-attachments/assets/34bebbdc-ae80-4e08-8512-199c57cb5b54\">\r\n\r\n\r\n---\r\n\r\n- Optimized fetching of pipelines, indices and stats, reducing the\r\nnumber of API calls to ES\r\n\r\nSeveral issues with the old endpoint stemmed from the with_indices flag.\r\nThis flag triggered a method designed for the Model Map feature, which\r\ninvolved fetching a complete list of pipelines, iterating over each\r\nmodel, retrieving index settings multiple times, and obtaining both\r\nindex content and a full list of transforms.\r\n\r\nThe new endpoint solves these issues by fetching only the necessary\r\ninformation for the Trained Model page with minimal calls to\r\nElasticsearch.\r\n\r\n#### APM transaction with a new endpoint \r\n<img width=\"1822\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/55e4a5f0-e571-46a2-b7ad-5b5a6fc44ceb\">\r\n\r\n#### APM transaction with an old endpoint\r\n\r\n\r\nhttps://github.com/user-attachments/assets/c9d62ddb-5e13-4ac1-9cbf-d685fbed7808\r\n\r\n---\r\n\r\n- Improves type definitions for different model types\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"e067fa239de670123c4f7d6aaba3d6001796babe","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement",":ml","Feature:Data Frame Analytics","v9.0.0","Feature:3rd Party Models","Team:ML","backport:version","v8.17.0","v8.18.0"],"number":200977,"url":"https://github.com/elastic/kibana/pull/200977","mergeCommit":{"message":"[ML] Trained Models: Optimize trained models Kibana API (#200977)\n\n## Summary\r\n\r\nCloses #191939 \r\nCloses https://github.com/elastic/kibana/issues/175220\r\n\r\nAdds various optimizations for the Trained Models page:\r\n\r\n---\r\n\r\n- Creates a new Kibana `/trained_models_list` endpoint responsible for\r\nfetching complete data for the Trained Model UI page, including\r\npipelines, indices and stats.\r\n\r\nBefore the Trained Models page required 3 endpoints. The new\r\n`trained_models_list` replaces them, reducing the overall latency.\r\n\r\n<img width=\"715\" alt=\"Screenshot 2024-12-02 at 16 18 32\"\r\nsrc=\"https://github.com/user-attachments/assets/34bebbdc-ae80-4e08-8512-199c57cb5b54\">\r\n\r\n\r\n---\r\n\r\n- Optimized fetching of pipelines, indices and stats, reducing the\r\nnumber of API calls to ES\r\n\r\nSeveral issues with the old endpoint stemmed from the with_indices flag.\r\nThis flag triggered a method designed for the Model Map feature, which\r\ninvolved fetching a complete list of pipelines, iterating over each\r\nmodel, retrieving index settings multiple times, and obtaining both\r\nindex content and a full list of transforms.\r\n\r\nThe new endpoint solves these issues by fetching only the necessary\r\ninformation for the Trained Model page with minimal calls to\r\nElasticsearch.\r\n\r\n#### APM transaction with a new endpoint \r\n<img width=\"1822\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/55e4a5f0-e571-46a2-b7ad-5b5a6fc44ceb\">\r\n\r\n#### APM transaction with an old endpoint\r\n\r\n\r\nhttps://github.com/user-attachments/assets/c9d62ddb-5e13-4ac1-9cbf-d685fbed7808\r\n\r\n---\r\n\r\n- Improves type definitions for different model types\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"e067fa239de670123c4f7d6aaba3d6001796babe"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200977","number":200977,"mergeCommit":{"message":"[ML] Trained Models: Optimize trained models Kibana API (#200977)\n\n## Summary\r\n\r\nCloses #191939 \r\nCloses https://github.com/elastic/kibana/issues/175220\r\n\r\nAdds various optimizations for the Trained Models page:\r\n\r\n---\r\n\r\n- Creates a new Kibana `/trained_models_list` endpoint responsible for\r\nfetching complete data for the Trained Model UI page, including\r\npipelines, indices and stats.\r\n\r\nBefore the Trained Models page required 3 endpoints. The new\r\n`trained_models_list` replaces them, reducing the overall latency.\r\n\r\n<img width=\"715\" alt=\"Screenshot 2024-12-02 at 16 18 32\"\r\nsrc=\"https://github.com/user-attachments/assets/34bebbdc-ae80-4e08-8512-199c57cb5b54\">\r\n\r\n\r\n---\r\n\r\n- Optimized fetching of pipelines, indices and stats, reducing the\r\nnumber of API calls to ES\r\n\r\nSeveral issues with the old endpoint stemmed from the with_indices flag.\r\nThis flag triggered a method designed for the Model Map feature, which\r\ninvolved fetching a complete list of pipelines, iterating over each\r\nmodel, retrieving index settings multiple times, and obtaining both\r\nindex content and a full list of transforms.\r\n\r\nThe new endpoint solves these issues by fetching only the necessary\r\ninformation for the Trained Model page with minimal calls to\r\nElasticsearch.\r\n\r\n#### APM transaction with a new endpoint \r\n<img width=\"1822\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/55e4a5f0-e571-46a2-b7ad-5b5a6fc44ceb\">\r\n\r\n#### APM transaction with an old endpoint\r\n\r\n\r\nhttps://github.com/user-attachments/assets/c9d62ddb-5e13-4ac1-9cbf-d685fbed7808\r\n\r\n---\r\n\r\n- Improves type definitions for different model types\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"e067fa239de670123c4f7d6aaba3d6001796babe"}},{"branch":"8.17","label":"v8.17.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","labelRegex":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
- Loading branch information