[Reporting] queue.pollEnabled setting adds ability to disable polling for idle jobs (#24295)

* [Reporting] New queue.pollEnabled setting adds ability to disable polling for idle jobs

* add an info log line

* note in docs
This commit is contained in:
Tim Sullivan 2018-10-24 08:03:54 -07:00 committed by GitHub
parent 5079e3d052
commit 6084acc8b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 3 deletions

View file

@ -51,8 +51,22 @@ reports, you might need to change the following settings.
How often the index that stores reporting jobs rolls over to a new index.
Valid values are `year`, `month`, `week`, `day`, and `hour`. Defaults to `week`.
`xpack.reporting.queue.pollEnabled`::
Set to `true` (default) to enable the Kibana instance to to poll the index for
pending jobs and claim them for execution. Setting this to `false` allows the
Kibana instance to only add new jobs to the reporting queue, list jobs, and
provide the downloads to completed report through the UI.
[NOTE]
============
Running multiple instances of Kibana in a cluster for load balancing of
reporting requires identical values for `xpack.reporting.encryptionKey` and, if
security is enabled, `xpack.security.encryptionKey`.
============
`xpack.reporting.queue.pollInterval`::
How often idle workers poll the index for pending jobs. Defaults to `3000` (3 seconds).
Specifies the number of milliseconds that idle workers wait between polling the
index for pending jobs. Defaults to `3000` (3 seconds).
[[xpack-reporting-q-timeout]]`xpack.reporting.queue.timeout`::
How long each worker has to produce a report. If your machine is slow or under

View file

@ -71,6 +71,7 @@ export const reporting = (kibana) => {
}).default(),
queue: Joi.object({
indexInterval: Joi.string().default('week'),
pollEnabled: Joi.boolean().default(true),
pollInterval: Joi.number().integer().default(3000),
pollIntervalErrorMultiplier: Joi.number().integer().default(10),
timeout: Joi.number().integer().default(120000),

View file

@ -18,18 +18,30 @@ function createQueueFn(server) {
const createWorkers = createWorkersFactory(server);
const { getClient } = server.plugins.elasticsearch.getCluster('admin');
const logger = createTaggedLogger(server, ['reporting', 'esqueue']);
const queueOptions = {
doctype: QUEUE_DOCTYPE,
interval: queueConfig.indexInterval,
timeout: queueConfig.timeout,
dateSeparator: dateSeparator,
client: getClient(),
logger: createTaggedLogger(server, ['reporting', 'esqueue'])
logger,
};
const queue = new Esqueue(index, queueOptions);
createWorkers(queue);
if (queueConfig.pollEnabled) {
// create workers to poll the index for idle jobs waiting to be claimed and executed
createWorkers(queue);
} else {
logger(
'xpack.reporting.queue.pollEnabled is set to false. This Kibana instance ' +
'will not poll for idle jobs to claim and execute. Make sure another ' +
'Kibana instance with polling enabled is running in this cluster so ' +
'reporting jobs can complete.',
['info']
);
}
return queue;
}