Skip to content

[Screenshotting] instrument for benchmark tests using new EventLogger class#130356

Merged
tsullivan merged 37 commits intoelastic:mainfrom
tsullivan:screenshotting/filebeat-monitoring
May 6, 2022
Merged

[Screenshotting] instrument for benchmark tests using new EventLogger class#130356
tsullivan merged 37 commits intoelastic:mainfrom
tsullivan:screenshotting/filebeat-monitoring

Conversation

@tsullivan
Copy link
Copy Markdown
Member

@tsullivan tsullivan commented Apr 15, 2022

This PR follows the model of using a central event logger that was set by Reporting in #124762, and integrates APM within the logger.

Summary

We want benchmarks on basic stats encountered by the screenshotting plugin when it runs a screenshot operation.

See JSON logging format, and ECS data documentation: https://www.elastic.co/guide/en/kibana/master/logging-configuration.html#json-layout

Logging configuration

To test this PR, use the following logging configuration in the kibana.yml file. As you create test screenshot reports, the kibana.log file will be populated with data that Filebeat can ingest.

logging:
  appenders.file:
    type: file
    fileName: kibana.log
    layout.type: json
  loggers:
    - name: plugins.screenshotting
      appenders: [file]
      level: debug

Checklist

Delete any items that are not applicable to this PR.

Example logs

{ "message": "screenshot-pipeline starting",
  "kibana": {
    "screenshotting": {
      "action": "screenshot-pipeline-start",
      "session_id": "fdb42c7b-505b-4676-9a5c-6bb1a8971167"
    }
  },
  "event": { "provider": "screenshotting" },
  "ecs": { "version": "8.0.0" },
  "@timestamp": "2022-04-18T11:03:46.219-07:00",
  "log": {
    "level": "DEBUG",
    "logger": "plugins.screenshotting.events"
  },
  "process": { "pid": 428095 },
  "trace": { "id": "140f9fa09315b0dcc196dd91443798c5" },
  "transaction": { "id": "ae31694f8944d22e" } }

{ "message": "opening url",
  "kibana": {
    "screenshotting": {
      "action": "open-url-start",
      "session_id": "fdb42c7b-505b-4676-9a5c-6bb1a8971167"
    }
  },
  "event": { "provider": "screenshotting" },
  "ecs": { "version": "8.0.0" },
  "@timestamp": "2022-04-18T11:03:46.309-07:00",
  "log": {
    "level": "DEBUG",
    "logger": "plugins.screenshotting.events"
  },
  "process": { "pid": 428095 },
  "span": { "id": "04eb3a42cf4cda22" },
  "trace": { "id": "140f9fa09315b0dcc196dd91443798c5" } }

{ "message": "finished opening url",
  "kibana": {
    "screenshotting": {
      "action": "open-url-complete",
      "session_id": "fdb42c7b-505b-4676-9a5c-6bb1a8971167"
    }
  },
  "event": {
    "duration": 2448,
    "provider": "screenshotting"
  },
  "ecs": { "version": "8.0.0" },
  "@timestamp": "2022-04-18T11:03:48.757-07:00",
  "log": {
    "level": "DEBUG",
    "logger": "plugins.screenshotting.events"
  },
  "process": { "pid": 428095 },
  "trace": { "id": "140f9fa09315b0dcc196dd91443798c5" },
  "transaction": { "id": "ae31694f8944d22e" } }

{ "message": "getting number of visualization items",
  "kibana": {
    "screenshotting": {
      "action": "get-number-of-items-start",
      "session_id": "fdb42c7b-505b-4676-9a5c-6bb1a8971167"
    }
  },
  "event": { "provider": "screenshotting" },
  "ecs": { "version": "8.0.0" },
  "@timestamp": "2022-04-18T11:03:48.757-07:00",
  "log": {
    "level": "DEBUG",
    "logger": "plugins.screenshotting.events"
  },
  "process": { "pid": 428095 },
  "span": { "id": "68006204c8c9114b" },
  "trace": { "id": "140f9fa09315b0dcc196dd91443798c5" } }

{ "message": "received number of visualization items",
  "kibana": {
    "screenshotting": {
      "action": "get-number-of-items-complete",
      "items_count": 13,
      "session_id": "fdb42c7b-505b-4676-9a5c-6bb1a8971167"
    }
  },
  "event": {
    "duration": 1045,
    "provider": "screenshotting"
  },
  "ecs": { "version": "8.0.0" },
  "@timestamp": "2022-04-18T11:03:49.802-07:00",
  "log": {
    "level": "DEBUG",
    "logger": "plugins.screenshotting.events"
  },
  "process": { "pid": 428095 },
  "span": { "id": "04eb3a42cf4cda22" },
  "trace": { "id": "140f9fa09315b0dcc196dd91443798c5" } }

@tsullivan tsullivan force-pushed the screenshotting/filebeat-monitoring branch from 1ebae57 to b27fdf9 Compare April 18, 2022 14:09
@tsullivan tsullivan force-pushed the screenshotting/filebeat-monitoring branch from b27fdf9 to 7d85baf Compare April 18, 2022 17:55
@tsullivan tsullivan changed the title [Screenshotting] instrument for Filebeat logging using new EventLogger class [Screenshotting] instrument for benchmark tests using new EventLogger class Apr 18, 2022
@tsullivan tsullivan force-pushed the screenshotting/filebeat-monitoring branch from 66c944f to a003341 Compare April 18, 2022 19:43
@tsullivan tsullivan force-pushed the screenshotting/filebeat-monitoring branch from a003341 to e9ade66 Compare April 18, 2022 19:50
@tsullivan tsullivan marked this pull request as ready for review April 18, 2022 19:52
@tsullivan tsullivan added zDeprecated Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:skip Skip the PR/issue when compiling release notes v8.3.0 Team:AppServicesUx labels Apr 18, 2022
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-app-services (Team:AppServicesUx)

@tsullivan tsullivan requested review from dokmic, jloleysens and vadimkibana and removed request for jloleysens April 18, 2022 21:55
@tsullivan tsullivan force-pushed the screenshotting/filebeat-monitoring branch from 62f808b to 396ea7c Compare April 20, 2022 01:07
@tsullivan tsullivan force-pushed the screenshotting/filebeat-monitoring branch 2 times, most recently from 6da7f5e to 295d2a9 Compare April 20, 2022 23:46
@tsullivan tsullivan force-pushed the screenshotting/filebeat-monitoring branch from 295d2a9 to 7fd2b50 Compare April 21, 2022 00:29
@tsullivan tsullivan requested a review from jloleysens May 3, 2022 22:31
Copy link
Copy Markdown
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my feedback @tsullivan ! This is looking really great. I did not test this locally (thanks for adding the tests!)

@tsullivan
Copy link
Copy Markdown
Member Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Copy Markdown

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
screenshotting 7 8 +1
Unknown metric groups

API count

id before after diff
screenshotting 27 28 +1

History

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

@tsullivan tsullivan merged commit fadd817 into elastic:main May 6, 2022
@kibanamachine kibanamachine added the backport:skip This PR does not require backporting label May 6, 2022
@tsullivan tsullivan deleted the screenshotting/filebeat-monitoring branch May 6, 2022 19:44
jloleysens added a commit to jloleysens/kibana that referenced this pull request May 9, 2022
…hromium-to-print-pdf-part-1

* 'main' of github.com:elastic/kibana: (59 commits)
  [Cloud Posture] Enabled findings group by feature (elastic#131780)
  [EBT] Fix `userId` generation (elastic#131701)
  [RAM] Add shareable rule tag filter (elastic#130710)
  Optimize package installation performance, phase 2 (elastic#131627)
  [Screenshotting] instrument for benchmark tests using new EventLogger class (elastic#130356)
  [Connector] Adding internal route for requesting ad-hoc ServiceNow access token (elastic#131171)
  [ci] bump kibana-buildkite-library (elastic#131754)
  [Synthetics] UI clean up (elastic#131598)
  [RsponseOps] Fix flaky rules list test (elastic#131567)
  [Cases] Add severity field to create case (elastic#131626)
  [Discover] Monospace font in Document Explorer (elastic#131513)
  Sessions tab improvements (elastic#131583)
  Add cloud icon "ess-icon" at the end of the config keys in "alerting" documentation (elastic#131735)
  [DOCS] Updates deprecation text for legacy APIs (elastic#131741)
  [ci] break out skip patterns so they can change without triggering CI (elastic#131726)
  Adjust search session management page font size (elastic#131291)
  [Unified search] Fix uptime css problem (elastic#131730)
  [Actionable Observability] Link to filtered rules page (elastic#131629)
  Add openAPI specifications for cases endpoint (elastic#131275)
  Display rule API key owner to users who can manage API keys (elastic#131662)
  ...

# Conflicts:
#	x-pack/plugins/screenshotting/server/formats/pdf/index.ts
#	x-pack/plugins/screenshotting/server/screenshots/observable.ts
kertal pushed a commit to kertal/kibana that referenced this pull request May 24, 2022
… class (elastic#130356)

* use an EventLogger throughout a screenshotting flow

* unique id for each pipeline flow

* fix open_url logging

* add comments

* add unit test

* fix getTimeRangeEnd

* improve logging of thrown errors

* log the number of pixels using zoom

* use elementPositionAndAttributes for logging

* fix tests

* replace multiple methods for logging spans with single log method

* fix test

* fix sessionId not showing in error logs

* prettify message

* more logging improvements

* add specific error logging around get screenshots

* function level comments

* error handling around getting render errors

* ensure original logger.error always still called

* fix error logs not having the right logging context

* more error logging around pdfMaker

* more error logging around re-position elements

* fix test

* fix error re-throw after logging

* use apm to capture the error

* simplify eventLogger api

* single startTransaction method

* shortcut methods for screenshot/pdf event log

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes v8.3.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.

6 participants