-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Reporting: register a single ESQueue worker, simultaneous poll for all export types #32839
Reporting: register a single ESQueue worker, simultaneous poll for all export types #32839
Conversation
e2b8128
to
169f791
Compare
const conditions = get(body, conditionPath); | ||
expect(conditions.must).to.eql({ term: { jobtype: jobtype } }); | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is no longer relevant, because each search should now turn up a waiting job for any type
@@ -357,7 +362,6 @@ export class Worker extends events.EventEmitter { | |||
filter: { | |||
bool: { | |||
minimum_should_match: 1, | |||
must: { term: { jobtype: this.jobtype } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jenkins test this |
💚 Build Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM w/ tweaks. Just a code-review. It seems reasonable. I only had minor comments.
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
// @ts-ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're ignoring due to the import being untyped, this should be:
// @ts-ignore untyped dependency
Otherwise, maybe add a comment about why these are ignored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to know! This is way more preferable, now it will complain if the module is not found.
I had a bad habit of this. I think I have a followup PR now to fix more of these :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh I misunderstood: that isn't a syntax that causes just that one type of error to be ignored ts
logger.debug(`Worker completed: (${res.job.id})`); | ||
}); | ||
worker.on(esqueueEvents.EVENT_WORKER_JOB_EXECUTION_ERROR, (res: any) => { | ||
logger.debug(`Worker error: (${res.job.id})`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should be higher than a debug message? Maybe not... could get spammy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like these are redundant actually. It looks like the code usually logs a warning before firing one of the "bad" Esqueue events. We would probably not lose anything from removing these event handlers...
Probably best to leave them as debug
for now, that was the original behavior since log
was hardcoded to be debug in this file: https://github.com/elastic/kibana/blob/master/x-pack/plugins/reporting/server/lib/create_workers.js#L21
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, there's a few events that get emitted/bound that no subscribers even listen to iirc.
💚 Build Succeeded |
@@ -0,0 +1,99 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for going the distance on the tests!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…ll export types (elastic#32839) * Reporting: register a single ESQueue worker, simultaneous poll for all export types * more typescript * PLUGIN_ID constant * move down log / internal state * fix tests * jest test for createWorker * assert arguments to queue.registerWorker * logic move * make ts ignore specific * minor reversion to fix some esqueue worker tests
💔 Build Failed |
…ll export types (#32839) (#33339) * Reporting: register a single ESQueue worker, simultaneous poll for all export types * more typescript * PLUGIN_ID constant * move down log / internal state * fix tests * jest test for createWorker * assert arguments to queue.registerWorker * logic move * make ts ignore specific * minor reversion to fix some esqueue worker tests
Fixes #32089
Have a single ESQueue worker registered for Reporting. The single worker handles multiple export types by routing the claimed job details to the proper export type execute function, using a Map object (
jobExecutors
)create_workers.js
tocreate_worker.ts
TODO: