Skip to content

Commit

Permalink
fix config errors
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <[email protected]>
  • Loading branch information
joshuali925 committed Dec 21, 2023
1 parent 36a82fc commit 247283b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
4 changes: 2 additions & 2 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "observabilityDashboards",
"version": "2.11.0.0",
"opensearchDashboardsVersion": "2.11.0",
"version": "3.0.0.0",
"opensearchDashboardsVersion": "3.0.0",
"server": true,
"ui": true,
"requiredPlugins": [
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "observability-dashboards",
"version": "2.11.0.0",
"version": "3.0.0.0",
"main": "index.ts",
"license": "Apache-2.0",
"scripts": {
Expand Down Expand Up @@ -82,4 +82,4 @@
"node_modules/*",
"target/*"
]
}
}
15 changes: 12 additions & 3 deletions server/routes/query_assist/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function registerQueryAssistRoutes(router: IRouter, config: Observability
ppl_agent_id: pplAgentId,
response_summary_agent_id: responseSummaryAgentId,
error_summary_agent_id: ErrorSummaryAgentId,
} = config.observability.query_assist;
} = config.query_assist;

router.post(
{
Expand All @@ -54,7 +54,12 @@ export function registerQueryAssistRoutes(router: IRouter, config: Observability
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
if (!pplAgentId) return response.custom({ statusCode: 400, body: 'PPL agent not found.' });
if (!pplAgentId)
return response.custom({
statusCode: 400,
body:
'PPL agent not found in opensearch_dashboards.yml. Expected observability.query_assist.ppl_agent_id',
});

const client = context.core.opensearch.client.asCurrentUser;
try {
Expand Down Expand Up @@ -112,7 +117,11 @@ export function registerQueryAssistRoutes(router: IRouter, config: Observability
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {
if (!responseSummaryAgentId || !ErrorSummaryAgentId)
return response.custom({ statusCode: 400, body: 'Summary agent not found.' });
return response.custom({
statusCode: 400,
body:
'Summary agent not found in opensearch_dashboards.yml. Expected observability.query_assist.response_summary_agent_id and observability.query_assist.error_summary_agent_id',
});

const client = context.core.opensearch.client.asCurrentUser;
const { index, question, query, response: _response, isError } = request.body;
Expand Down

0 comments on commit 247283b

Please sign in to comment.