Skip to content

Commit 30455ec

Browse files
[8.19] Remove inline function call (elastic#235250) (elastic#235268)
# Backport This will backport the following commits from `main` to `8.19`: - [Remove inline function call (elastic#235250)](elastic#235250) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Jason Rhodes","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-09-16T20:04:36Z","message":"Remove inline function call (elastic#235250)\n\n## Summary\n\nWe [made this change](elastic#195208) to\nprevent a layout bug with the contextual insight component that writes\nan empty div even when there are no messages to write. But this solution\nresults in over-calling this expensive function. This PR rolls that back\nto avoid OOM errors.\n\nWe can find a different way to fix the layout bug.\n\n## To reproduce\n\n* Make sure you have an AI connector enabled for your local setup\n* Create a custom threshold rule that will fire\n* Go to the alert details page for this alert\n* Notice the network panel shows 3 calls to the\n`alert_details_contextual_insights` endpoint, without any interaction\nwith the \"Contextual insights\" accordion panel\n\n### Before \n\n<img width=\"1072\" height=\"897\" alt=\"Screenshot 2025-09-16 at 1 19 13 PM\"\nsrc=\"https://github.com/user-attachments/assets/4bb5a89e-83b6-42da-a5cd-9163c2a97b50\"\n/>\n\n### After\n\nIn this branch, you will see no calls to that same endpoint unless the\npanel is opened.\n\n<img width=\"1080\" height=\"901\" alt=\"Screenshot 2025-09-16 at 1 19 38 PM\"\nsrc=\"https://github.com/user-attachments/assets/258a9673-de7f-4813-ba20-76422d6e9136\"\n/>","sha":"6fe884d2c3af51b474e7ff308d5ec24f2d0a636d","branchLabelMapping":{"^v9.2.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-ux-management","backport:version","author:obs-ux-management","v9.2.0","v8.19.5","v9.1.5"],"title":"Remove inline function call","number":235250,"url":"https://github.com/elastic/kibana/pull/235250","mergeCommit":{"message":"Remove inline function call (elastic#235250)\n\n## Summary\n\nWe [made this change](elastic#195208) to\nprevent a layout bug with the contextual insight component that writes\nan empty div even when there are no messages to write. But this solution\nresults in over-calling this expensive function. This PR rolls that back\nto avoid OOM errors.\n\nWe can find a different way to fix the layout bug.\n\n## To reproduce\n\n* Make sure you have an AI connector enabled for your local setup\n* Create a custom threshold rule that will fire\n* Go to the alert details page for this alert\n* Notice the network panel shows 3 calls to the\n`alert_details_contextual_insights` endpoint, without any interaction\nwith the \"Contextual insights\" accordion panel\n\n### Before \n\n<img width=\"1072\" height=\"897\" alt=\"Screenshot 2025-09-16 at 1 19 13 PM\"\nsrc=\"https://github.com/user-attachments/assets/4bb5a89e-83b6-42da-a5cd-9163c2a97b50\"\n/>\n\n### After\n\nIn this branch, you will see no calls to that same endpoint unless the\npanel is opened.\n\n<img width=\"1080\" height=\"901\" alt=\"Screenshot 2025-09-16 at 1 19 38 PM\"\nsrc=\"https://github.com/user-attachments/assets/258a9673-de7f-4813-ba20-76422d6e9136\"\n/>","sha":"6fe884d2c3af51b474e7ff308d5ec24f2d0a636d"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.1"],"targetPullRequestStates":[{"branch":"main","label":"v9.2.0","branchLabelMappingKey":"^v9.2.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/235250","number":235250,"mergeCommit":{"message":"Remove inline function call (elastic#235250)\n\n## Summary\n\nWe [made this change](elastic#195208) to\nprevent a layout bug with the contextual insight component that writes\nan empty div even when there are no messages to write. But this solution\nresults in over-calling this expensive function. This PR rolls that back\nto avoid OOM errors.\n\nWe can find a different way to fix the layout bug.\n\n## To reproduce\n\n* Make sure you have an AI connector enabled for your local setup\n* Create a custom threshold rule that will fire\n* Go to the alert details page for this alert\n* Notice the network panel shows 3 calls to the\n`alert_details_contextual_insights` endpoint, without any interaction\nwith the \"Contextual insights\" accordion panel\n\n### Before \n\n<img width=\"1072\" height=\"897\" alt=\"Screenshot 2025-09-16 at 1 19 13 PM\"\nsrc=\"https://github.com/user-attachments/assets/4bb5a89e-83b6-42da-a5cd-9163c2a97b50\"\n/>\n\n### After\n\nIn this branch, you will see no calls to that same endpoint unless the\npanel is opened.\n\n<img width=\"1080\" height=\"901\" alt=\"Screenshot 2025-09-16 at 1 19 38 PM\"\nsrc=\"https://github.com/user-attachments/assets/258a9673-de7f-4813-ba20-76422d6e9136\"\n/>","sha":"6fe884d2c3af51b474e7ff308d5ec24f2d0a636d"}},{"branch":"8.19","label":"v8.19.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.1","label":"v9.1.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Jason Rhodes <[email protected]>
1 parent 760e6a4 commit 30455ec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

x-pack/solutions/observability/plugins/observability/public/pages/alert_details/alert_details_contextual_insights.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export function AlertDetailContextualInsights({ alert }: { alert: AlertData | nu
8686
}
8787
}, [alert, http, observabilityAIAssistant]);
8888

89-
if (!ObservabilityAIAssistantContextualInsight || !getAlertContextMessages()) {
89+
if (!ObservabilityAIAssistantContextualInsight) {
9090
return null;
9191
}
9292

0 commit comments

Comments
 (0)