diff --git a/x-pack/plugins/ingest_manager/common/constants/agent.ts b/x-pack/plugins/ingest_manager/common/constants/agent.ts index 7652c6ac87bc..d94f536b5659 100644 --- a/x-pack/plugins/ingest_manager/common/constants/agent.ts +++ b/x-pack/plugins/ingest_manager/common/constants/agent.ts @@ -17,5 +17,5 @@ export const AGENT_POLLING_INTERVAL = 1000; export const AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS = 30000; export const AGENT_UPDATE_ACTIONS_INTERVAL_MS = 5000; -export const AGENT_CONFIG_ROLLUP_RATE_LIMIT_INTERVAL_MS = 5000; -export const AGENT_CONFIG_ROLLUP_RATE_LIMIT_REQUEST_PER_INTERVAL = 60; +export const AGENT_CONFIG_ROLLOUT_RATE_LIMIT_INTERVAL_MS = 5000; +export const AGENT_CONFIG_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL = 25; diff --git a/x-pack/plugins/ingest_manager/server/constants/index.ts b/x-pack/plugins/ingest_manager/server/constants/index.ts index 1ec13bd80f0f..730d8cf7b172 100644 --- a/x-pack/plugins/ingest_manager/server/constants/index.ts +++ b/x-pack/plugins/ingest_manager/server/constants/index.ts @@ -10,8 +10,8 @@ export { AGENT_POLLING_THRESHOLD_MS, AGENT_POLLING_INTERVAL, AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS, - AGENT_CONFIG_ROLLUP_RATE_LIMIT_REQUEST_PER_INTERVAL, - AGENT_CONFIG_ROLLUP_RATE_LIMIT_INTERVAL_MS, + AGENT_CONFIG_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL, + AGENT_CONFIG_ROLLOUT_RATE_LIMIT_INTERVAL_MS, AGENT_UPDATE_ACTIONS_INTERVAL_MS, INDEX_PATTERN_PLACEHOLDER_SUFFIX, // Routes diff --git a/x-pack/plugins/ingest_manager/server/index.ts b/x-pack/plugins/ingest_manager/server/index.ts index e2f659f54d62..9933266a441e 100644 --- a/x-pack/plugins/ingest_manager/server/index.ts +++ b/x-pack/plugins/ingest_manager/server/index.ts @@ -6,6 +6,10 @@ import { schema, TypeOf } from '@kbn/config-schema'; import { PluginInitializerContext } from 'src/core/server'; import { IngestManagerPlugin } from './plugin'; +import { + AGENT_CONFIG_ROLLOUT_RATE_LIMIT_INTERVAL_MS, + AGENT_CONFIG_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL, +} from '../common'; export { AgentService, ESIndexPatternService, getRegistryUrl } from './services'; export { IngestManagerSetupContract, @@ -35,8 +39,12 @@ export const config = { host: schema.maybe(schema.string()), ca_sha256: schema.maybe(schema.string()), }), - agentConfigRolloutRateLimitIntervalMs: schema.number({ defaultValue: 5000 }), - agentConfigRolloutRateLimitRequestPerInterval: schema.number({ defaultValue: 5 }), + agentConfigRolloutRateLimitIntervalMs: schema.number({ + defaultValue: AGENT_CONFIG_ROLLOUT_RATE_LIMIT_INTERVAL_MS, + }), + agentConfigRolloutRateLimitRequestPerInterval: schema.number({ + defaultValue: AGENT_CONFIG_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL, + }), }), }), }; diff --git a/x-pack/plugins/ingest_manager/server/services/agents/checkin/state_new_actions.ts b/x-pack/plugins/ingest_manager/server/services/agents/checkin/state_new_actions.ts index 1547b6b5ea05..418b59e1ca2e 100644 --- a/x-pack/plugins/ingest_manager/server/services/agents/checkin/state_new_actions.ts +++ b/x-pack/plugins/ingest_manager/server/services/agents/checkin/state_new_actions.ts @@ -25,7 +25,12 @@ import { } from '../../../types'; import { agentConfigService } from '../../agent_config'; import * as APIKeysService from '../../api_keys'; -import { AGENT_SAVED_OBJECT_TYPE, AGENT_UPDATE_ACTIONS_INTERVAL_MS } from '../../../constants'; +import { + AGENT_SAVED_OBJECT_TYPE, + AGENT_UPDATE_ACTIONS_INTERVAL_MS, + AGENT_CONFIG_ROLLOUT_RATE_LIMIT_INTERVAL_MS, + AGENT_CONFIG_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL, +} from '../../../constants'; import { createAgentAction, getNewActionsSince } from '../actions'; import { appContextService } from '../../app_context'; import { toPromiseAbortable, AbortError, createRateLimiter } from './rxjs_utils'; @@ -135,8 +140,10 @@ export function agentCheckinStateNewActionsFactory() { const newActions$ = createNewActionsSharedObservable(); // Rx operators const rateLimiter = createRateLimiter( - appContextService.getConfig()?.fleet.agentConfigRolloutRateLimitIntervalMs ?? 5000, - appContextService.getConfig()?.fleet.agentConfigRolloutRateLimitRequestPerInterval ?? 50 + appContextService.getConfig()?.fleet.agentConfigRolloutRateLimitIntervalMs ?? + AGENT_CONFIG_ROLLOUT_RATE_LIMIT_INTERVAL_MS, + appContextService.getConfig()?.fleet.agentConfigRolloutRateLimitRequestPerInterval ?? + AGENT_CONFIG_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL ); async function subscribeToNewActions(