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

[Reporting] APM integration for baseline performance measurements #59967

Merged
merged 27 commits into from
May 7, 2020

Conversation

tsullivan
Copy link
Member

@tsullivan tsullivan commented Mar 11, 2020

Summary

Part of #59396

Refer to #43548 for information about Kibana's APM integrations.

Adds APM transactions and spans around the slow parts of Reporting code.

This lets us see a trace of where the flow is taking the most time when screenshots are captured. Here is an example of capturing a Dashboard with "print_layout" mode. You can see the multiple calls to get_screenshots:

image

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@tsullivan tsullivan changed the title Reporting/performance measurement [Reporting] APM integration for baseline performance measurements Mar 11, 2020
@tsullivan tsullivan force-pushed the reporting/performance-measurement branch from 5fca169 to 1b2a777 Compare March 11, 2020 23:39
const item = elementsPositionAndAttributes[i];
const base64EncodedData = await asyncDurationLogger(
Copy link
Member Author

@tsullivan tsullivan Mar 12, 2020

Choose a reason for hiding this comment

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

asyncDurationLogger was hiding a type error, because we're resolving a string, not a Buffer

Copy link
Member Author

Choose a reason for hiding this comment

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

More context about this: since we'll have APM to measure the duration of all these modules, we no longer need this helper function. After having removed it, I noticed the surrounding code treated the helper function return value as a Buffer but it is actually a string of base64 content.

@tsullivan tsullivan force-pushed the reporting/performance-measurement branch from 1b2a777 to 4a5af92 Compare March 12, 2020 01:04
@tsullivan tsullivan force-pushed the reporting/performance-measurement branch from 4a5af92 to a865bcc Compare March 12, 2020 16:48
@tsullivan tsullivan marked this pull request as ready for review March 12, 2020 21:22
@tsullivan tsullivan requested a review from a team as a code owner March 12, 2020 21:22
@tsullivan tsullivan added (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:skip Skip the PR/issue when compiling release notes Team:Reporting Services v8.0.0 labels Mar 12, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-reporting-services (Team:Reporting Services)

Copy link
Member

@vigneshshanmugam vigneshshanmugam left a comment

Choose a reason for hiding this comment

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

Amazing job on doing the full custom instrumentation using the APM Node.js agent. Love to see we are dog fooding more.

I just have one small suggestion, It just personal opinion as Span can be null | Span at any point in time. You could have a generic tracer utility

// utility
function startTrace() {
   const span = apm.startSpan(...);
   return () {
        span && span.end()
   }
}


// in actual code
const endTrace = startTrace(name, type)

endTrace()

Helps to avoid the if check everywhere.

@@ -54,13 +54,14 @@ export const executeJobFactory: QueuedPngExecutorFactory = async function execut
job.layout
);
}),
map(({ buffer, warnings }) => {
map(({ base64, warnings }) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to rename this - it was very unclear that the return payload actually is a string

@tsullivan
Copy link
Member Author

@elasticmachine merge upstream

@tsullivan
Copy link
Member Author

Will merge this after the 7.8 branch is cut

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@tsullivan tsullivan removed the blocked label May 7, 2020
@tsullivan tsullivan merged commit 6bf0890 into elastic:master May 7, 2020
tsullivan added a commit to tsullivan/kibana that referenced this pull request May 8, 2020
…astic#59967)

* apm stuff

* fix cluster_client

* fix snapshot

* tracker utility for generate_pdf

* call apm.startSpan instead of txn.startSpan

* Fix async call to end transaction

* fix typescript

* remove captuureErrors

* restore accidental removal

* add startTrace lib

* fix import

* fix imports

* ts fix

* fix generate_png to not format base64 to buffer and back to base64

* 💅

* revert change to cluster client

* fix unused translation

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
jloleysens added a commit to jloleysens/kibana that referenced this pull request May 8, 2020
…or-part-mvp-2

* 'master' of github.com:elastic/kibana: (259 commits)
  SavedObjects bulkCreate API should return migrationVersion and strip the type & namespace from the id (elastic#65150)
  Drilldown count tooltip (elastic#65105)
  plugins logs start with "plugins." prefix (elastic#65710)
  [ML] Fix pagination reset on search query update. (elastic#65668)
  [SIEM] Add types to the mappings objects so extra keys cannot be introduced
  [apm] Update machine learning flyout and service maps docs (elastic#65517)
  change api endpoint and throw error (elastic#65790)
  [Maps] remove SLA percentage metric (elastic#65718)
  [Reporting] APM integration for baseline performance measurements (elastic#59967)
  fix(NA): noParse regex for windows on kbn optimizer (elastic#65755)
  [ML] DFA: ensure at least one field is included in analysis before job can be created (elastic#65320)
  [Data plugin] cleanup - remove unused getRoutes / routes from indexPattern object (elastic#65683)
  Removed skip to enable test. (elastic#65575)
  [Lens] Type safe migrations (elastic#65576)
  [Canvas] Fix nav link behavior in Canvas  (elastic#65590)
  [Event log] Fix flaky test (elastic#65658)
  [Alerting] changes preconfigured actions config from array to object (elastic#65397)
  remove immediate functions from esqueue worker cycles (elastic#65375)
  [Metrics UI] Fix isAbove to only display when threshold set (elastic#65540)
  draft search profiler accessibility tests (elastic#62357)
  ...

# Conflicts:
#	x-pack/plugins/ingest_pipelines/public/application/components/pipeline_form/pipeline_form_fields.tsx
tsullivan added a commit that referenced this pull request May 8, 2020
…9967) (#65797)

* apm stuff

* fix cluster_client

* fix snapshot

* tracker utility for generate_pdf

* call apm.startSpan instead of txn.startSpan

* Fix async call to end transaction

* fix typescript

* remove captuureErrors

* restore accidental removal

* add startTrace lib

* fix import

* fix imports

* ts fix

* fix generate_png to not format base64 to buffer and back to base64

* 💅

* revert change to cluster client

* fix unused translation

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
@tsullivan tsullivan deleted the reporting/performance-measurement branch May 8, 2020 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:skip Skip the PR/issue when compiling release notes v7.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants