mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Synthetics] Increase lightweight monitors project page size !! (#198696)
## Summary This is to support https://github.com/elastic/synthetics/issues/978 Increase lightweight monitors project page size, size of light weight monitors is minimal, heaving a small size is more of a burden then advantage since we do batch operations in kibana !! ### Why Since limit is only mostly applicable for browser monitors size, for lightweight we can safely do bulk operation on large number of monitors without hititng memory or size issues --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Justin Kambic <jk@elastic.co>
This commit is contained in:
parent
c28b173886
commit
bfcffa1e76
14 changed files with 68 additions and 50 deletions
|
@ -44590,7 +44590,6 @@
|
|||
"xpack.synthetics.server.monitors.invalidScheduleError": "La planification moniteur n’est pas valide",
|
||||
"xpack.synthetics.server.monitors.invalidSchemaError": "Le moniteur n'est pas un moniteur valide de type {type}",
|
||||
"xpack.synthetics.server.monitors.invalidTypeError": "Le type de moniteur n’est pas valide",
|
||||
"xpack.synthetics.server.project.delete.toolarge": "La charge utile de la requête de suppression est trop volumineuse. Veuillez envoyer au maximum 250 moniteurs à supprimer par requête",
|
||||
"xpack.synthetics.server.projectMonitors.invalidPrivateLocationError": "Emplacement privé non valide : \"{location}\". Supprimez-le ou remplacez-le par un emplacement privé valide.",
|
||||
"xpack.synthetics.server.projectMonitors.invalidPublicLocationError": "Emplacement non valide : \"{location}\". Supprimez-le ou remplacez-le par un emplacement valide.",
|
||||
"xpack.synthetics.server.projectMonitors.invalidPublicOriginError": "Type d'origine non pris en charge {origin}, seul le type ui est pris en charge par l'API.",
|
||||
|
|
|
@ -44443,7 +44443,6 @@
|
|||
"xpack.synthetics.server.monitors.invalidScheduleError": "モニタースケジュールが無効です",
|
||||
"xpack.synthetics.server.monitors.invalidSchemaError": "モニターは有効なタイプ{type}のモニターではありません。",
|
||||
"xpack.synthetics.server.monitors.invalidTypeError": "モニタータイプが無効です",
|
||||
"xpack.synthetics.server.project.delete.toolarge": "削除リクエストペイロードが大きすぎます。リクエストごとに送信できる削除するモニターは250以下にしてください",
|
||||
"xpack.synthetics.server.projectMonitors.invalidPrivateLocationError": "非公開の場所\"{location}\"が無効です。削除するか、有効な非公開の場所で置換してください。",
|
||||
"xpack.synthetics.server.projectMonitors.invalidPublicLocationError": "場所\"{location}\"が無効です。削除するか、有効な場所で置換してください。",
|
||||
"xpack.synthetics.server.projectMonitors.invalidPublicOriginError": "サポートされていない始点タイプ\"{origin}\"です。uiタイプのみがAPIでサポートされています。",
|
||||
|
|
|
@ -43786,7 +43786,6 @@
|
|||
"xpack.synthetics.server.monitors.invalidScheduleError": "监测计划无效",
|
||||
"xpack.synthetics.server.monitors.invalidSchemaError": "监测不是 {type} 类型的有效监测",
|
||||
"xpack.synthetics.server.monitors.invalidTypeError": "监测类型无效",
|
||||
"xpack.synthetics.server.project.delete.toolarge": "删除请求,有效负载太大。每个请求请最多发送 250 个要删除的监测",
|
||||
"xpack.synthetics.server.projectMonitors.invalidPublicOriginError": "不支持起源类型 {origin},仅通过 API 支持 UI 类型。",
|
||||
"xpack.synthetics.server.projectMonitors.locationEmptyError": "必须至少将一个位置或专用位置添加到此监测。",
|
||||
"xpack.synthetics.service.projectMonitors.cannotUpdateMonitorToDifferentType": "无法将监测更新为不同类型。",
|
||||
|
|
|
@ -36,15 +36,15 @@ import {
|
|||
getSyntheticsEnablementRoute,
|
||||
} from './synthetics_service/enablement';
|
||||
import { getSyntheticsMonitorRoute } from './monitor_cruds/get_monitor';
|
||||
import { deleteSyntheticsMonitorProjectRoute } from './monitor_cruds/delete_monitor_project';
|
||||
import { getSyntheticsProjectMonitorsRoute } from './monitor_cruds/get_monitor_project';
|
||||
import { deleteSyntheticsMonitorProjectRoute } from './monitor_cruds/project_monitor/delete_monitor_project';
|
||||
import { getSyntheticsProjectMonitorsRoute } from './monitor_cruds/project_monitor/get_monitor_project';
|
||||
import { runOnceSyntheticsMonitorRoute } from './synthetics_service/run_once_monitor';
|
||||
import { getServiceAllowedRoute } from './synthetics_service/get_service_allowed';
|
||||
import { testNowMonitorRoute } from './synthetics_service/test_now_monitor';
|
||||
import { installIndexTemplatesRoute } from './synthetics_service/install_index_templates';
|
||||
import { editSyntheticsMonitorRoute } from './monitor_cruds/edit_monitor';
|
||||
import { addSyntheticsMonitorRoute } from './monitor_cruds/add_monitor';
|
||||
import { addSyntheticsProjectMonitorRoute } from './monitor_cruds/add_monitor_project';
|
||||
import { addSyntheticsProjectMonitorRoute } from './monitor_cruds/project_monitor/add_monitor_project';
|
||||
import { syntheticsGetPingsRoute, syntheticsGetPingHeatmapRoute } from './pings';
|
||||
import { createGetCurrentStatusRoute } from './overview_status/overview_status';
|
||||
import { getHasIntegrationMonitorsRoute } from './fleet/get_has_integration_monitors';
|
||||
|
|
|
@ -11,7 +11,7 @@ import { isEmpty } from 'lodash';
|
|||
import { invalidOriginError } from './add_monitor';
|
||||
import { InvalidLocationError } from '../../synthetics_service/project_monitor/normalizers/common_fields';
|
||||
import { AddEditMonitorAPI, CreateMonitorPayLoad } from './add_monitor/add_monitor_api';
|
||||
import { ELASTIC_MANAGED_LOCATIONS_DISABLED } from './add_monitor_project';
|
||||
import { ELASTIC_MANAGED_LOCATIONS_DISABLED } from './project_monitor/add_monitor_project';
|
||||
import { getDecryptedMonitor } from '../../saved_objects/synthetics_monitor';
|
||||
import { getPrivateLocations } from '../../synthetics_service/get_private_locations';
|
||||
import { mergeSourceMonitor } from './formatters/saved_object_to_monitor';
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import { schema } from '@kbn/config-schema';
|
||||
import { SecurityCreateApiKeyResponse } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { IKibanaResponse } from '@kbn/core-http-server';
|
||||
import { ELASTIC_MANAGED_LOCATIONS_DISABLED } from './add_monitor_project';
|
||||
import { ELASTIC_MANAGED_LOCATIONS_DISABLED } from './project_monitor/add_monitor_project';
|
||||
import { SyntheticsRestApiRouteFactory } from '../types';
|
||||
import { generateProjectAPIKey } from '../../synthetics_service/get_api_key';
|
||||
import { SYNTHETICS_API_URLS } from '../../../common/constants';
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
import { schema } from '@kbn/config-schema';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { DEFAULT_SPACE_ID } from '@kbn/spaces-plugin/common';
|
||||
import { validateSpaceId } from './services/validate_space_id';
|
||||
import { RouteContext, SyntheticsRestApiRouteFactory } from '../types';
|
||||
import { ProjectMonitor } from '../../../common/runtime_types';
|
||||
import { validateSpaceId } from '../services/validate_space_id';
|
||||
import { RouteContext, SyntheticsRestApiRouteFactory } from '../../types';
|
||||
import { ProjectMonitor } from '../../../../common/runtime_types';
|
||||
|
||||
import { SYNTHETICS_API_URLS } from '../../../common/constants';
|
||||
import { ProjectMonitorFormatter } from '../../synthetics_service/project_monitor/project_monitor_formatter';
|
||||
import { SYNTHETICS_API_URLS } from '../../../../common/constants';
|
||||
import { ProjectMonitorFormatter } from '../../../synthetics_service/project_monitor/project_monitor_formatter';
|
||||
|
||||
const MAX_PAYLOAD_SIZE = 1048576 * 50; // 50MiB
|
||||
const MAX_PAYLOAD_SIZE = 1048576 * 100; // 50MiB
|
||||
|
||||
export const addSyntheticsProjectMonitorRoute: SyntheticsRestApiRouteFactory = () => ({
|
||||
method: 'PUT',
|
||||
|
@ -37,19 +37,29 @@ export const addSyntheticsProjectMonitorRoute: SyntheticsRestApiRouteFactory = (
|
|||
const { projectName } = request.params;
|
||||
const decodedProjectName = decodeURI(projectName);
|
||||
const monitors = (request.body?.monitors as ProjectMonitor[]) || [];
|
||||
const lightWeightMonitors = monitors.filter((monitor) => monitor.type !== 'browser');
|
||||
const browserMonitors = monitors.filter((monitor) => monitor.type === 'browser');
|
||||
|
||||
if (monitors.length > 250) {
|
||||
if (browserMonitors.length > 250) {
|
||||
return response.badRequest({
|
||||
body: {
|
||||
message: REQUEST_TOO_LARGE,
|
||||
},
|
||||
});
|
||||
}
|
||||
if (lightWeightMonitors.length > 1500) {
|
||||
return response.badRequest({
|
||||
body: {
|
||||
message: REQUEST_TOO_LARGE_LIGHTWEIGHT,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
const spaceId = await validateSpaceId(routeContext);
|
||||
|
||||
const permissionError = await validatePermissions(routeContext, monitors);
|
||||
const [spaceId, permissionError] = await Promise.all([
|
||||
validateSpaceId(routeContext),
|
||||
validatePermissions(routeContext, monitors),
|
||||
]);
|
||||
|
||||
if (permissionError) {
|
||||
return response.forbidden({ body: { message: permissionError } });
|
||||
|
@ -84,11 +94,19 @@ export const addSyntheticsProjectMonitorRoute: SyntheticsRestApiRouteFactory = (
|
|||
},
|
||||
});
|
||||
|
||||
export const REQUEST_TOO_LARGE = i18n.translate('xpack.synthetics.server.project.delete.toolarge', {
|
||||
export const REQUEST_TOO_LARGE = i18n.translate('xpack.synthetics.server.project.delete.request', {
|
||||
defaultMessage:
|
||||
'Delete request payload is too large. Please send a max of 250 monitors to delete per request',
|
||||
'Request payload is too large. Please send a max of 250 browser monitors per request.',
|
||||
});
|
||||
|
||||
export const REQUEST_TOO_LARGE_LIGHTWEIGHT = i18n.translate(
|
||||
'xpack.synthetics.server.project.delete.request.lightweight',
|
||||
{
|
||||
defaultMessage:
|
||||
'Request payload is too large. Please send a max of 1500 lightweight monitors per request.',
|
||||
}
|
||||
);
|
||||
|
||||
export const validatePermissions = async (
|
||||
{ server, response, request }: RouteContext,
|
||||
projectMonitors: ProjectMonitor[]
|
|
@ -6,13 +6,13 @@
|
|||
*/
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { DeleteMonitorAPI } from './services/delete_monitor_api';
|
||||
import { SyntheticsRestApiRouteFactory } from '../types';
|
||||
import { syntheticsMonitorType } from '../../../common/types/saved_objects';
|
||||
import { ConfigKey } from '../../../common/runtime_types';
|
||||
import { SYNTHETICS_API_URLS } from '../../../common/constants';
|
||||
import { getMonitors, getSavedObjectKqlFilter } from '../common';
|
||||
import { validateSpaceId } from './services/validate_space_id';
|
||||
import { DeleteMonitorAPI } from '../services/delete_monitor_api';
|
||||
import { SyntheticsRestApiRouteFactory } from '../../types';
|
||||
import { syntheticsMonitorType } from '../../../../common/types/saved_objects';
|
||||
import { ConfigKey } from '../../../../common/runtime_types';
|
||||
import { SYNTHETICS_API_URLS } from '../../../../common/constants';
|
||||
import { getMonitors, getSavedObjectKqlFilter } from '../../common';
|
||||
import { validateSpaceId } from '../services/validate_space_id';
|
||||
|
||||
export const deleteSyntheticsMonitorProjectRoute: SyntheticsRestApiRouteFactory = () => ({
|
||||
method: 'DELETE',
|
||||
|
@ -30,10 +30,10 @@ export const deleteSyntheticsMonitorProjectRoute: SyntheticsRestApiRouteFactory
|
|||
const { projectName } = request.params;
|
||||
const { monitors: monitorsToDelete } = request.body;
|
||||
const decodedProjectName = decodeURI(projectName);
|
||||
if (monitorsToDelete.length > 250) {
|
||||
if (monitorsToDelete.length > 500) {
|
||||
return response.badRequest({
|
||||
body: {
|
||||
message: REQUEST_TOO_LARGE,
|
||||
message: REQUEST_TOO_LARGE_DELETE,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -70,7 +70,10 @@ export const deleteSyntheticsMonitorProjectRoute: SyntheticsRestApiRouteFactory
|
|||
},
|
||||
});
|
||||
|
||||
export const REQUEST_TOO_LARGE = i18n.translate('xpack.synthetics.server.project.delete.toolarge', {
|
||||
defaultMessage:
|
||||
'Delete request payload is too large. Please send a max of 250 monitors to delete per request',
|
||||
});
|
||||
export const REQUEST_TOO_LARGE_DELETE = i18n.translate(
|
||||
'xpack.synthetics.server.project.delete.tooLarge',
|
||||
{
|
||||
defaultMessage:
|
||||
'Delete request payload is too large. Please send a max of 500 monitors to delete per request',
|
||||
}
|
||||
);
|
|
@ -5,11 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
import { schema } from '@kbn/config-schema';
|
||||
import { SyntheticsRestApiRouteFactory } from '../types';
|
||||
import { syntheticsMonitorType } from '../../../common/types/saved_objects';
|
||||
import { ConfigKey } from '../../../common/runtime_types';
|
||||
import { SYNTHETICS_API_URLS } from '../../../common/constants';
|
||||
import { getMonitors } from '../common';
|
||||
import { SyntheticsRestApiRouteFactory } from '../../types';
|
||||
import { syntheticsMonitorType } from '../../../../common/types/saved_objects';
|
||||
import { ConfigKey } from '../../../../common/runtime_types';
|
||||
import { SYNTHETICS_API_URLS } from '../../../../common/constants';
|
||||
import { getMonitors } from '../../common';
|
||||
|
||||
const querySchema = schema.object({
|
||||
search_after: schema.maybe(schema.string()),
|
|
@ -148,7 +148,7 @@ export class ProjectMonitorFormatter {
|
|||
(monitorObj) => monitorObj[ConfigKey.JOURNEY_ID] === monitor.id
|
||||
);
|
||||
|
||||
const normM = await this.validateProjectMonitor({
|
||||
const normM = this.validateProjectMonitor({
|
||||
monitor,
|
||||
publicLocations: this.publicLocations,
|
||||
privateLocations: this.privateLocations,
|
||||
|
@ -189,7 +189,7 @@ export class ProjectMonitorFormatter {
|
|||
]);
|
||||
};
|
||||
|
||||
validateProjectMonitor = async ({
|
||||
validateProjectMonitor = ({
|
||||
monitor,
|
||||
publicLocations,
|
||||
privateLocations,
|
||||
|
|
|
@ -12,7 +12,7 @@ import { formatKibanaNamespace } from '@kbn/synthetics-plugin/common/formatters'
|
|||
import {
|
||||
ELASTIC_MANAGED_LOCATIONS_DISABLED,
|
||||
REQUEST_TOO_LARGE,
|
||||
} from '@kbn/synthetics-plugin/server/routes/monitor_cruds/add_monitor_project';
|
||||
} from '@kbn/synthetics-plugin/server/routes/monitor_cruds/project_monitor/add_monitor_project';
|
||||
import { PackagePolicy } from '@kbn/fleet-plugin/common';
|
||||
import {
|
||||
PROFILE_VALUES_ENUM,
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { ConfigKey, ProjectMonitorsRequest } from '@kbn/synthetics-plugin/common/runtime_types';
|
||||
import { REQUEST_TOO_LARGE } from '@kbn/synthetics-plugin/server/routes/monitor_cruds/delete_monitor_project';
|
||||
import { REQUEST_TOO_LARGE_DELETE } from '@kbn/synthetics-plugin/server/routes/monitor_cruds/project_monitor/delete_monitor_project';
|
||||
import { SYNTHETICS_API_URLS } from '@kbn/synthetics-plugin/common/constants';
|
||||
import { PackagePolicy } from '@kbn/fleet-plugin/common';
|
||||
import expect from '@kbn/expect';
|
||||
|
@ -47,10 +47,10 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
projectMonitors = setUniqueIds(getFixtureJson('project_browser_monitor'));
|
||||
});
|
||||
|
||||
it('only allows 250 requests at a time', async () => {
|
||||
it('only allows 500 requests at a time', async () => {
|
||||
const project = 'test-brower-suite';
|
||||
const monitors = [];
|
||||
for (let i = 0; i < 251; i++) {
|
||||
for (let i = 0; i < 550; i++) {
|
||||
monitors.push({
|
||||
...projectMonitors.monitors[0],
|
||||
id: `test-id-${i}`,
|
||||
|
@ -93,7 +93,7 @@ export default function ({ getService }: FtrProviderContext) {
|
|||
.send({ monitors: monitorsToDelete })
|
||||
.expect(400);
|
||||
const { message } = response.body;
|
||||
expect(message).to.eql(REQUEST_TOO_LARGE);
|
||||
expect(message).to.eql(REQUEST_TOO_LARGE_DELETE);
|
||||
} finally {
|
||||
await supertest
|
||||
.delete(
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
} from '@kbn/synthetics-plugin/common/runtime_types';
|
||||
import { SYNTHETICS_API_URLS } from '@kbn/synthetics-plugin/common/constants';
|
||||
import { formatKibanaNamespace } from '@kbn/synthetics-plugin/common/formatters';
|
||||
import { REQUEST_TOO_LARGE } from '@kbn/synthetics-plugin/server/routes/monitor_cruds/add_monitor_project';
|
||||
import { REQUEST_TOO_LARGE } from '@kbn/synthetics-plugin/server/routes/monitor_cruds/project_monitor/add_monitor_project';
|
||||
import { PackagePolicy } from '@kbn/fleet-plugin/common';
|
||||
import {
|
||||
PROFILE_VALUES_ENUM,
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
ProjectMonitorsRequest,
|
||||
PrivateLocation,
|
||||
} from '@kbn/synthetics-plugin/common/runtime_types';
|
||||
import { REQUEST_TOO_LARGE } from '@kbn/synthetics-plugin/server/routes/monitor_cruds/delete_monitor_project';
|
||||
import { REQUEST_TOO_LARGE_DELETE } from '@kbn/synthetics-plugin/server/routes/monitor_cruds/project_monitor/delete_monitor_project';
|
||||
import { SYNTHETICS_API_URLS } from '@kbn/synthetics-plugin/common/constants';
|
||||
import { PackagePolicy } from '@kbn/fleet-plugin/common';
|
||||
import expect from '@kbn/expect';
|
||||
|
@ -61,10 +61,10 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
|
|||
]);
|
||||
});
|
||||
|
||||
it('only allows 250 requests at a time', async () => {
|
||||
it('only allows 500 requests at a time', async () => {
|
||||
const project = 'test-brower-suite';
|
||||
const monitors = [];
|
||||
for (let i = 0; i < 251; i++) {
|
||||
for (let i = 0; i < 550; i++) {
|
||||
monitors.push({
|
||||
...projectMonitors.monitors[0],
|
||||
id: `test-id-${i}`,
|
||||
|
@ -112,7 +112,7 @@ export default function ({ getService }: DeploymentAgnosticFtrProviderContext) {
|
|||
.send({ monitors: monitorsToDelete })
|
||||
.expect(400);
|
||||
const { message } = response.body;
|
||||
expect(message).to.eql(REQUEST_TOO_LARGE);
|
||||
expect(message).to.eql(REQUEST_TOO_LARGE_DELETE);
|
||||
} finally {
|
||||
await supertest
|
||||
.delete(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue