Skip to content

Commit cebcc3a

Browse files
authored
[Ingest Manager] Fix agent config rollout rate limit to use constants (#75364)
1 parent 37f4f28 commit cebcc3a

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

x-pack/plugins/ingest_manager/common/constants/agent.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ export const AGENT_POLLING_INTERVAL = 1000;
1717
export const AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS = 30000;
1818
export const AGENT_UPDATE_ACTIONS_INTERVAL_MS = 5000;
1919

20-
export const AGENT_CONFIG_ROLLUP_RATE_LIMIT_INTERVAL_MS = 5000;
21-
export const AGENT_CONFIG_ROLLUP_RATE_LIMIT_REQUEST_PER_INTERVAL = 60;
20+
export const AGENT_CONFIG_ROLLOUT_RATE_LIMIT_INTERVAL_MS = 5000;
21+
export const AGENT_CONFIG_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL = 25;

x-pack/plugins/ingest_manager/server/constants/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export {
1010
AGENT_POLLING_THRESHOLD_MS,
1111
AGENT_POLLING_INTERVAL,
1212
AGENT_UPDATE_LAST_CHECKIN_INTERVAL_MS,
13-
AGENT_CONFIG_ROLLUP_RATE_LIMIT_REQUEST_PER_INTERVAL,
14-
AGENT_CONFIG_ROLLUP_RATE_LIMIT_INTERVAL_MS,
13+
AGENT_CONFIG_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL,
14+
AGENT_CONFIG_ROLLOUT_RATE_LIMIT_INTERVAL_MS,
1515
AGENT_UPDATE_ACTIONS_INTERVAL_MS,
1616
INDEX_PATTERN_PLACEHOLDER_SUFFIX,
1717
// Routes

x-pack/plugins/ingest_manager/server/index.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
import { schema, TypeOf } from '@kbn/config-schema';
77
import { PluginInitializerContext } from 'src/core/server';
88
import { IngestManagerPlugin } from './plugin';
9+
import {
10+
AGENT_CONFIG_ROLLOUT_RATE_LIMIT_INTERVAL_MS,
11+
AGENT_CONFIG_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL,
12+
} from '../common';
913
export { AgentService, ESIndexPatternService, getRegistryUrl } from './services';
1014
export {
1115
IngestManagerSetupContract,
@@ -35,8 +39,12 @@ export const config = {
3539
host: schema.maybe(schema.string()),
3640
ca_sha256: schema.maybe(schema.string()),
3741
}),
38-
agentConfigRolloutRateLimitIntervalMs: schema.number({ defaultValue: 5000 }),
39-
agentConfigRolloutRateLimitRequestPerInterval: schema.number({ defaultValue: 5 }),
42+
agentConfigRolloutRateLimitIntervalMs: schema.number({
43+
defaultValue: AGENT_CONFIG_ROLLOUT_RATE_LIMIT_INTERVAL_MS,
44+
}),
45+
agentConfigRolloutRateLimitRequestPerInterval: schema.number({
46+
defaultValue: AGENT_CONFIG_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL,
47+
}),
4048
}),
4149
}),
4250
};

x-pack/plugins/ingest_manager/server/services/agents/checkin/state_new_actions.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ import {
2525
} from '../../../types';
2626
import { agentConfigService } from '../../agent_config';
2727
import * as APIKeysService from '../../api_keys';
28-
import { AGENT_SAVED_OBJECT_TYPE, AGENT_UPDATE_ACTIONS_INTERVAL_MS } from '../../../constants';
28+
import {
29+
AGENT_SAVED_OBJECT_TYPE,
30+
AGENT_UPDATE_ACTIONS_INTERVAL_MS,
31+
AGENT_CONFIG_ROLLOUT_RATE_LIMIT_INTERVAL_MS,
32+
AGENT_CONFIG_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL,
33+
} from '../../../constants';
2934
import { createAgentAction, getNewActionsSince } from '../actions';
3035
import { appContextService } from '../../app_context';
3136
import { toPromiseAbortable, AbortError, createRateLimiter } from './rxjs_utils';
@@ -135,8 +140,10 @@ export function agentCheckinStateNewActionsFactory() {
135140
const newActions$ = createNewActionsSharedObservable();
136141
// Rx operators
137142
const rateLimiter = createRateLimiter(
138-
appContextService.getConfig()?.fleet.agentConfigRolloutRateLimitIntervalMs ?? 5000,
139-
appContextService.getConfig()?.fleet.agentConfigRolloutRateLimitRequestPerInterval ?? 50
143+
appContextService.getConfig()?.fleet.agentConfigRolloutRateLimitIntervalMs ??
144+
AGENT_CONFIG_ROLLOUT_RATE_LIMIT_INTERVAL_MS,
145+
appContextService.getConfig()?.fleet.agentConfigRolloutRateLimitRequestPerInterval ??
146+
AGENT_CONFIG_ROLLOUT_RATE_LIMIT_REQUEST_PER_INTERVAL
140147
);
141148

142149
async function subscribeToNewActions(

0 commit comments

Comments
 (0)