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

[task manager] provide warning when setting max_workers greater than limit #85574

Merged
merged 3 commits into from
Dec 14, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions x-pack/plugins/task_manager/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { schema, TypeOf } from '@kbn/config-schema';

export const MAX_MAX_WORKERS = 100;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Total nit. but... can we maybe name it something like MAX_WORKERS_LIMIT?
MAX_MAX_WORKERS feels like a typo 😆

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for that - I like yours better, mine did seem a bit odd :-)

export const DEFAULT_MAX_WORKERS = 10;
export const DEFAULT_POLL_INTERVAL = 3000;
export const DEFAULT_MAX_POLL_INACTIVITY_CYCLES = 10;
Expand Down
9 changes: 9 additions & 0 deletions x-pack/plugins/task_manager/server/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,13 @@ describe('deprecations', () => {
`);
});
});

it('logs a warning if max_workers is over limit', () => {
const { messages } = applyTaskManagerDeprecations({ max_workers: 1000 });
expect(messages).toMatchInlineSnapshot(`
Array [
"setting \\"xpack.task_manager.max_workers\\" (1000) greater than 100 is deprecated. Values greater than 100 will not be supported starting in 8.0.",
]
`);
});
});
7 changes: 6 additions & 1 deletion x-pack/plugins/task_manager/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { get } from 'lodash';
import { PluginConfigDescriptor, PluginInitializerContext } from 'src/core/server';
import { TaskManagerPlugin } from './plugin';
import { configSchema, TaskManagerConfig } from './config';
import { configSchema, TaskManagerConfig, MAX_MAX_WORKERS } from './config';

export const plugin = (initContext: PluginInitializerContext) => new TaskManagerPlugin(initContext);

Expand Down Expand Up @@ -37,6 +37,11 @@ export const config: PluginConfigDescriptor<TaskManagerConfig> = {
`"${fromPath}.index" is deprecated. Multitenancy by changing "kibana.index" will not be supported starting in 8.0. See https://ela.st/kbn-remove-legacy-multitenancy for more details`
);
}
if (taskManager?.max_workers > MAX_MAX_WORKERS) {
log(
`setting "${fromPath}.max_workers" (${taskManager?.max_workers}) greater than ${MAX_MAX_WORKERS} is deprecated. Values greater than ${MAX_MAX_WORKERS} will not be supported starting in 8.0.`
);
}
return settings;
},
],
Expand Down