From 11b8412f1d4519471a44db6e24259181277479a8 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Fri, 4 Oct 2024 00:09:32 +0800 Subject: [PATCH] Pass top N log pattern data from alerting context provider to agent (#341) (#342) (cherry picked from commit a6af310437757bc4e4c3a3bd1320e97ba0a7edb2) Signed-off-by: github-actions[bot] # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] --- public/components/incontext_insight/generate_popover_body.tsx | 2 ++ server/routes/summary_routes.ts | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/public/components/incontext_insight/generate_popover_body.tsx b/public/components/incontext_insight/generate_popover_body.tsx index 7b812c84..e3326aa3 100644 --- a/public/components/incontext_insight/generate_popover_body.tsx +++ b/public/components/incontext_insight/generate_popover_body.tsx @@ -104,6 +104,7 @@ export const GeneratePopoverBody: React.FC<{ : undefined; const index = contextObj?.additionalInfo?.index; const dsl = contextObj?.additionalInfo?.dsl; + const topNLogPatternData = contextObj?.additionalInfo?.topNLogPatternData; await httpSetup ?.post(SUMMARY_ASSISTANT_API.SUMMARIZE, { @@ -114,6 +115,7 @@ export const GeneratePopoverBody: React.FC<{ context: contextContent, index, dsl, + topNLogPatternData, }), query: dataSourceQuery, }) diff --git a/server/routes/summary_routes.ts b/server/routes/summary_routes.ts index a3feea81..f5c9c058 100644 --- a/server/routes/summary_routes.ts +++ b/server/routes/summary_routes.ts @@ -32,6 +32,7 @@ export function registerSummaryAssistantRoutes( context: schema.maybe(schema.string()), index: schema.maybe(schema.string()), dsl: schema.maybe(schema.string()), + topNLogPatternData: schema.maybe(schema.string()), }), query: schema.object({ dataSourceId: schema.maybe(schema.string()), @@ -45,7 +46,7 @@ export function registerSummaryAssistantRoutes( }); const assistantClient = assistantService.getScopedClient(req, context); const agentConfigId = - req.body.index && req.body.dsl + req.body.index && req.body.dsl && req.body.topNLogPatternData ? LOG_PATTERN_SUMMARY_AGENT_CONFIG_ID : SUMMARY_AGENT_CONFIG_ID; const response = await assistantClient.executeAgentByConfigName(agentConfigId, { @@ -53,6 +54,7 @@ export function registerSummaryAssistantRoutes( question: req.body.question, index: req.body.index, input: req.body.dsl, + topNLogPatternData: req.body.topNLogPatternData, }); let summary; let insightAgentIdExists = false;