Skip to content
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

Improve alert summary with backend log pattern experience #389

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Optimize the response of AI agent APIs ([#373](https://github.com/opensearch-project/dashboards-assistant/pull/373), [#380](https://github.com/opensearch-project/dashboards-assistant/pull/380))
- fixed incorrect message id field used ([#378](https://github.com/opensearch-project/dashboards-assistant/pull/378))
- fix: return 404 instead of 500 for missing agent config name ([#384](https://github.com/opensearch-project/dashboards-assistant/pull/384))
- Improve alert summary with backend log pattern experience ([#389](https://github.com/opensearch-project/dashboards-assistant/pull/389))

### Infrastructure

Expand Down
8 changes: 4 additions & 4 deletions server/routes/summary_routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function registerSummaryAssistantRoutes(
});
const assistantClient = assistantService.getScopedClient(req, context);
const agentConfigId =
req.body.index && req.body.dsl && req.body.topNLogPatternData
req.body.index && req.body.dsl
? LOG_PATTERN_SUMMARY_AGENT_CONFIG_ID
: SUMMARY_AGENT_CONFIG_ID;
try {
Expand Down Expand Up @@ -135,7 +135,7 @@ export function registerSummaryAssistantRoutes(
);
}

function detectInsightAgentId(
async function detectInsightAgentId(
insightType: string,
summaryType: string,
client: OpenSearchClient['transport']
Expand All @@ -144,9 +144,9 @@ function detectInsightAgentId(
// only get it by searching on name since it is not stored in agent config.
try {
if (insightType === 'os_insight') {
return getAgentIdByConfigName(OS_INSIGHT_AGENT_CONFIG_ID, client);
return await getAgentIdByConfigName(OS_INSIGHT_AGENT_CONFIG_ID, client);
} else if (insightType === 'user_insight' && summaryType === 'alerts') {
return searchAgent({ name: 'KB_For_Alert_Insight' }, client);
return await searchAgent({ name: 'KB_For_Alert_Insight' }, client);
}
} catch (e) {
// It only detects if the agent exists, we don't want to throw the error when not found the agent
Expand Down
Loading