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

[Backport 2.x] [MDS][Bug]added changes for de registering plugins not in MDS and changed other… #2227

Merged
merged 1 commit into from
Oct 22, 2024
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
12 changes: 6 additions & 6 deletions server/routes/application_analytics/app_analytics_router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 30 in server/routes/application_analytics/app_analytics_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const opensearchClient: ILegacyScopedClusterClient = context.observability_plugin.observabilityClient.asScoped(
request
);
Expand All @@ -39,10 +39,10 @@
data: applicationsData,
},
});
} catch (err: any) {

Check warning on line 42 in server/routes/application_analytics/app_analytics_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
console.error('Error occurred while fetching applications', err);
return response.custom({
statusCode: err.statusCode || 500,
statusCode: err.statusCode || 400,
body: err.message,
});
}
Expand All @@ -63,7 +63,7 @@
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 66 in server/routes/application_analytics/app_analytics_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const opensearchClient: ILegacyScopedClusterClient = context.observability_plugin.observabilityClient.asScoped(
request
);
Expand All @@ -75,10 +75,10 @@
return response.ok({
body: appObject,
});
} catch (err: any) {

Check warning on line 78 in server/routes/application_analytics/app_analytics_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
console.error('Error occurred while fetching application', err);
return response.custom({
statusCode: err.statusCode || 500,
statusCode: err.statusCode || 400,
body: err.message,
});
}
Expand All @@ -104,7 +104,7 @@
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 107 in server/routes/application_analytics/app_analytics_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const opensearchClient: ILegacyScopedClusterClient = context.observability_plugin.observabilityClient.asScoped(
request
);
Expand All @@ -117,10 +117,10 @@
newAppId,
},
});
} catch (err: any) {

Check warning on line 120 in server/routes/application_analytics/app_analytics_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
console.error('Error occurred while creating a new application', err);
return response.custom({
statusCode: err.statusCode || 500,
statusCode: err.statusCode || 400,
body: err.message,
});
}
Expand All @@ -142,7 +142,7 @@
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 145 in server/routes/application_analytics/app_analytics_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const opensearchClient: ILegacyScopedClusterClient = context.observability_plugin.observabilityClient.asScoped(
request
);
Expand All @@ -158,10 +158,10 @@
message: 'Application Renamed',
},
});
} catch (err: any) {

Check warning on line 161 in server/routes/application_analytics/app_analytics_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
console.error('Error occurred while renaming an existing application', err);
return response.custom({
statusCode: err.statusCode || 500,
statusCode: err.statusCode || 400,
body: err.message,
});
}
Expand Down Expand Up @@ -190,7 +190,7 @@
context,
request,
response
): Promise<IOpenSearchDashboardsResponse<any | ResponseError>> => {

Check warning on line 193 in server/routes/application_analytics/app_analytics_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
const opensearchClient: ILegacyScopedClusterClient = context.observability_plugin.observabilityClient.asScoped(
request
);
Expand All @@ -207,10 +207,10 @@
updatedAppId,
},
});
} catch (err: any) {

Check warning on line 210 in server/routes/application_analytics/app_analytics_router.ts

View workflow job for this annotation

GitHub Actions / Lint

Unexpected any. Specify a different type
console.error('Error occurred while updating an existing application', err);
return response.custom({
statusCode: err.statusCode || 500,
statusCode: err.statusCode || 400,
body: err.message,
});
}
Expand Down Expand Up @@ -245,7 +245,7 @@
});
} catch (err: any) {
return response.custom({
statusCode: err.statusCode || 500,
statusCode: err.statusCode || 400,
body: err.message,
});
}
Expand Down
30 changes: 15 additions & 15 deletions server/routes/custom_panels/panels_router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function PanelsRouter(router: IRouter) {
} catch (error: any) {
console.error('Issue in fetching panel list:', error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand Down Expand Up @@ -77,7 +77,7 @@ export function PanelsRouter(router: IRouter) {
} catch (error: any) {
console.error('Issue in fetching panel:', error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand Down Expand Up @@ -118,7 +118,7 @@ export function PanelsRouter(router: IRouter) {
} catch (error: any) {
console.error('Issue in creating new panel', error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand Down Expand Up @@ -146,7 +146,7 @@ export function PanelsRouter(router: IRouter) {
);

try {
const responseBody = await customPanelBackend.updatePanel(
const _responseBody = await customPanelBackend.updatePanel(
opensearchNotebooksClient,
request.body.panelId,
request.body.panel
Expand All @@ -159,7 +159,7 @@ export function PanelsRouter(router: IRouter) {
} catch (error: any) {
console.error('Issue in updating panel', error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand Down Expand Up @@ -187,7 +187,7 @@ export function PanelsRouter(router: IRouter) {
);

try {
const responseBody = await customPanelBackend.renamePanel(
const _responseBody = await customPanelBackend.renamePanel(
opensearchNotebooksClient,
request.body.panelId,
request.body.panelName
Expand All @@ -200,7 +200,7 @@ export function PanelsRouter(router: IRouter) {
} catch (error: any) {
console.error('Issue in renaming panel', error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand Down Expand Up @@ -245,7 +245,7 @@ export function PanelsRouter(router: IRouter) {
} catch (error: any) {
console.error('Issue in cloning panel', error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand All @@ -272,7 +272,7 @@ export function PanelsRouter(router: IRouter) {
);

try {
const deleteResponse = await customPanelBackend.deletePanel(
const _deleteResponse = await customPanelBackend.deletePanel(
opensearchNotebooksClient,
request.params.panelId
);
Expand All @@ -284,7 +284,7 @@ export function PanelsRouter(router: IRouter) {
} catch (error: any) {
console.error('Issue in deleting panel', error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand All @@ -311,7 +311,7 @@ export function PanelsRouter(router: IRouter) {
);

try {
const deleteResponse = await customPanelBackend.deletePanelList(
const _deleteResponse = await customPanelBackend.deletePanelList(
opensearchNotebooksClient,
request.params.panelIdList
);
Expand All @@ -323,7 +323,7 @@ export function PanelsRouter(router: IRouter) {
} catch (error: any) {
console.error('Issue in deleting panel', error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand Down Expand Up @@ -354,7 +354,7 @@ export function PanelsRouter(router: IRouter) {
);

try {
const panelFilterResponse = await customPanelBackend.addPanelFilter(
const _panelFilterResponse = await customPanelBackend.addPanelFilter(
opensearchNotebooksClient,
request.body.panelId,
request.body.query,
Expand All @@ -370,7 +370,7 @@ export function PanelsRouter(router: IRouter) {
} catch (error: any) {
console.error('Issue in adding query filter', error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand Down Expand Up @@ -409,7 +409,7 @@ export function PanelsRouter(router: IRouter) {
} catch (error: any) {
console.error('Issue in fetching panel list:', error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand Down
20 changes: 10 additions & 10 deletions server/routes/event_analytics/event_analytics_router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const registerEventAnalyticsRouter = ({

if (savedRes.success || savedRes?.data?.statusCode === 404) return res.ok(result);

result.statusCode = savedRes?.data?.statusCode || 500;
result.statusCode = savedRes?.data?.statusCode || 400;
result.message = savedRes?.data || '';
return res.custom(result);
}
Expand All @@ -65,7 +65,7 @@ export const registerEventAnalyticsRouter = ({

if (savedRes.success || savedRes?.data?.statusCode === 404) return res.ok(result);

result.statusCode = savedRes?.data?.statusCode || 500;
result.statusCode = savedRes?.data?.statusCode || 400;
result.message = savedRes?.data || '';
return res.custom(result);
}
Expand Down Expand Up @@ -107,7 +107,7 @@ export const registerEventAnalyticsRouter = ({

if (savedRes.success) return res.ok(result);

result.statusCode = savedRes?.data?.statusCode || 500;
result.statusCode = savedRes?.data?.statusCode || 400;
result.message = savedRes?.data || '';
return res.custom(result);
}
Expand Down Expand Up @@ -160,7 +160,7 @@ export const registerEventAnalyticsRouter = ({

if (savedRes.success) return res.ok(result);

result.statusCode = savedRes?.data?.statusCode || 500;
result.statusCode = savedRes?.data?.statusCode || 400;
result.message = savedRes?.data || '';
return res.custom(result);
}
Expand Down Expand Up @@ -201,7 +201,7 @@ export const registerEventAnalyticsRouter = ({
},
};
if (savedRes.success) return res.ok(result);
result.statusCode = savedRes?.data?.statusCode || 500;
result.statusCode = savedRes?.data?.statusCode || 400;
result.message = savedRes?.data || '';
return res.custom(result);
}
Expand Down Expand Up @@ -253,7 +253,7 @@ export const registerEventAnalyticsRouter = ({
},
};
if (updateRes.success) return res.ok(result);
result.statusCode = updateRes?.data?.statusCode || 500;
result.statusCode = updateRes?.data?.statusCode || 400;
result.message = updateRes?.data || '';
return res.custom(result);
}
Expand Down Expand Up @@ -281,7 +281,7 @@ export const registerEventAnalyticsRouter = ({

if (savedRes.success) return res.ok(result);

result.statusCode = savedRes?.data?.statusCode || 500;
result.statusCode = savedRes?.data?.statusCode || 400;
result.message = savedRes?.data || '';
return res.custom(result);
}
Expand Down Expand Up @@ -312,7 +312,7 @@ export const registerEventAnalyticsRouter = ({

if (savedRes.success) return res.ok(result);

result.statusCode = savedRes?.data?.statusCode || 500;
result.statusCode = savedRes?.data?.statusCode || 400;
result.message = savedRes?.data || '';
return res.custom(result);
}
Expand All @@ -335,7 +335,7 @@ export const registerEventAnalyticsRouter = ({
},
};
if (deleteResponse.success) return res.ok(result);
result.statusCode = deleteResponse?.data?.statusCode || 500;
result.statusCode = deleteResponse?.data?.statusCode || 400;
result.message = deleteResponse?.data || '';
return res.custom(result);
}
Expand All @@ -360,7 +360,7 @@ export const registerEventAnalyticsRouter = ({

if (savedRes.success) return res.ok(result);

result.statusCode = savedRes?.data?.statusCode || 500;
result.statusCode = savedRes?.data?.statusCode || 400;
result.message = savedRes?.data || '';
return res.custom(result);
}
Expand Down
2 changes: 1 addition & 1 deletion server/routes/metrics/metrics_rounter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function registerMetricsRoute(router: IRouter, dataSourceEnabled: boolean
} catch (error) {
if (error.statusCode !== 404) console.error(error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand Down
2 changes: 1 addition & 1 deletion server/routes/ppl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function registerPplRoute({ router, facet }: { router: IRouter; facet: PP
return res.ok(result);
}
return res.custom({
statusCode: queryRes.data.statusCode || queryRes.data.status || 500,
statusCode: queryRes.data.statusCode || queryRes.data.status || 400,
body: queryRes.data.body || queryRes.data.message || '',
});
}
Expand Down
6 changes: 3 additions & 3 deletions server/routes/trace_analytics_dsl_router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function registerTraceAnalyticsDslRouter(router: IRouter, dataSourceEnabl
} catch (error) {
console.error(error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand Down Expand Up @@ -90,7 +90,7 @@ export function registerTraceAnalyticsDslRouter(router: IRouter, dataSourceEnabl
} catch (error) {
console.error(error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand Down Expand Up @@ -157,7 +157,7 @@ export function registerTraceAnalyticsDslRouter(router: IRouter, dataSourceEnabl
addRequestToMetric('trace_analytics', 'get', error);
if (error.statusCode !== 404) console.error(error);
return response.custom({
statusCode: error.statusCode || 500,
statusCode: error.statusCode || 400,
body: error.message,
});
}
Expand Down
Loading