Skip to content

[Reporting] Instantiate a logger top level, and use it throughout the job - #43636

Merged
tsullivan merged 3 commits into
elastic:masterfrom
tsullivan:reporting/more-typescript-executeJob-ii
Aug 26, 2019
Merged

tsullivan merged 3 commits into
elastic:masterfrom
tsullivan:reporting/more-typescript-executeJob-ii

Conversation

@tsullivan

@tsullivan tsullivan commented Aug 21, 2019 •

Copy link
Copy Markdown
Member

Summary

This PR creates jobLogger objects and shares them throughout the job creation flow and job execution flow. This really helps with job execution, because the jobLogger is now tagged with the jobID, which is now logged with every call to the logger. Having the jobID visible for each log line heavily improves logging experiences in Reporting.

server    log   [16:39:26.613] [info][queue-job][reporting] Successfully queued job: jz1w9pmb1hlo89fb5f8ffv8h
server    log   [16:39:26.727] [info][esqueue][reporting][worker] jz1w9l2z1hlo89fb5faeic0i - Claimed job jz1w9pmb1hlo89fb5f8ffv8h
server    log   [16:39:26.728] [info][esqueue][reporting][worker] jz1w9l2z1hlo89fb5faeic0i - Starting job
server    log   [16:39:27.002] [info][execute-job][jz1w9pmb1hlo89fb5f8ffv8h][printable_pdf][reporting] opening url https://spicy.local:443/kbn/app/kibana#/dashboard/49f5cb90-b3f7-11e9-8494-c920836ce301?_g=(refreshInterval%3A(pause%3A!t%2Cvalue%3A0)%2Ctime%3A(from%3Anow-45y%2Fy%2Cto%3Anow))&_a=(description%3A''%2Cfilters%3A!()%2CfullScreenMode%3A!f%2Coptions%3A(hidePanelTitles%3A!f%2CuseMargins%3A!t)%2Cpanels%3A!((embeddableConfig%3A()%2CgridData%3A(h%3A30%2Ci%3A'9fc4caed-0abd-4105-a53f-ff9e1415e350'%2Cw%3A48%2Cx%3A0%2Cy%3A0)%2Cid%3 A'2f8b67b0-b3f7-11e9-8494-c920836ce301'%2CpanelIndex%3A'9fc4caed-0abd-4105-a53f-ff9e1415e350'%2Ctype%3Avisualization%2Cversion%3A'8.0.0')%2C(embeddableConfig%3A()%2CgridData%3A(h%3A17%2Ci%3A'3512b09d-8a0b-4940-a969-71b896a7b216'%2Cw%3A15%2Cx%3A0%2Cy%3A30)%2Cid%3A'7547bb10-ae51-11e9-990d-d1cc7a0af960'%2CpanelIndex%3A'3512b09d-8a0b-4940-a969-71b896a7b216'%2Ctype%3Avisualization%2Cversion%3A'8.0.0')%2C(embeddableConfig%3A()%2CgridData%3A(h%3A17%2Ci%3Ae28befe4-ea77-42f4-acd8-2cacdf1dd9fc%2Cw%3A33%2Cx%3A15%2Cy%3A30)%2Cid%3A'003ecb10-ae51-11e9-990d-d1cc7a0af960'%2CpanelIndex%3Ae28befe4-ea77-42f4-acd8-2cacdf1dd9fc%2Ctype%3Asearch%2Cversion%3A'8.0.0'))%2Cquery%3A(language%3Akuery%2Cquery%3A'')%2CtimeRestore%3A!t%2Ctitle%3ABASHBIOARHY%2CviewMode%3Aview)&forceNow=2019-08-07T23%3A39%3A26.578Z
server    log   [16:39:32.638] [info][execute-job][jz1w9pmb1hlo89fb5f8ffv8h][printable_pdf][reporting] handled 73 page requests
server    log   [16:39:32.864] [info][execute-job][jz1w9pmb1hlo89fb5f8ffv8h][printable_pdf][reporting] found 3 rendered elements in the DOM
server    log   [16:39:34.203] [info][execute-job][jz1w9pmb1hlo89fb5f8ffv8h][printable_pdf][reporting] taking screenshots
server    log   [16:39:35.548] [info][execute-job][jz1w9pmb1hlo89fb5f8ffv8h][printable_pdf][reporting] screenshots taken: 3
server    log   [16:39:36.391] [info][esqueue][reporting][worker] jz1w9l2z1hlo89fb5faeic0i - Job execution completed successfully
server    log   [16:39:36.457] [info][esqueue][reporting][worker] jz1w9l2z1hlo89fb5faeic0i - Job data saved successfully: /.reporting-2019.08.04/_doc/jz1w9pmb1hlo89fb5f8ffv8h

Release Note: Improved the logging for Reporting to include the ID of the current job with every log line. Also, several logging events in Reporting have been raised from debug to info level.

(The last sentence refers to other changes prior to this PR.)

@tsullivan
tsullivan force-pushed the reporting/more-typescript-executeJob-ii branch from 389b336 to b470782 Compare August 21, 2019 00:56

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

In order to get control over how things get logged from within the Chromium driver, I decided it's best to NOT pass the logger to the HeadlessChromiumDriver constructor. Logging happens via the caller's logger object that gets passed to each method of the driver.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Note: removed a redundant tag

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was causing a redundant tag

Comment thread x-pack/legacy/plugins/reporting/types.d.ts Outdated
@tsullivan
tsullivan force-pushed the reporting/more-typescript-executeJob-ii branch 3 times, most recently from c5bf563 to 07c2287 Compare August 21, 2019 01:18
@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@tsullivan tsullivan added zDeprecated Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:enhancement Team:Stack Services labels Aug 21, 2019
@elasticmachine

Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-stack-services

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not exactly related to this PR, but this really should have been logged previously.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It turns out better to not have a logger tied to the instance. Instead, calling code passes in a logger to all the driver methods.

@tsullivan
tsullivan force-pushed the reporting/more-typescript-executeJob-ii branch from 07c2287 to ee58673 Compare August 22, 2019 03:04
@tsullivan
tsullivan requested review from joelgriffith and stacey-gammon and removed request for stacey-gammon August 22, 2019 03:05
@tsullivan
tsullivan marked this pull request as ready for review August 22, 2019 03:05
@elasticmachine

Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@joelgriffith

Copy link
Copy Markdown
Contributor

Code LGTM! Nice cleanup

@tsullivan
tsullivan requested a review from a team August 23, 2019 22:42
@elasticmachine

Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@bmcconaghy bmcconaghy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:enhancement v7.4.0 v8.0.0 zDeprecated Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants