Skip to content

Comments

[Reporting] Revisit handling timeouts for different phases of screenshot capture#113807

Merged
tsullivan merged 37 commits intoelastic:masterfrom
tsullivan:reporting/fix-wait-for-render
Oct 18, 2021
Merged

[Reporting] Revisit handling timeouts for different phases of screenshot capture#113807
tsullivan merged 37 commits intoelastic:masterfrom
tsullivan:reporting/fix-wait-for-render

Conversation

@tsullivan
Copy link
Member

@tsullivan tsullivan commented Oct 4, 2021

Summary

Closes #110718

This PR revises the timeout controls around the 3 different phases of screenshot capturing, and fixes an issue in the original implementation of #58683, which is that waiting for render can take up the entire reporting queue timeout time.

Other changes

  • Creates ScreenshotObservableHandler class to remove complex logic in the main getScreenshots$ function
  • Improves error messages that read You may need to increase '{configKey}'. This now checks if the error is an actual Rx.TimeoutError object.

Checklist

Delete any items that are not applicable to this PR.

@tsullivan tsullivan requested review from a team as code owners October 4, 2021 17:22
@tsullivan tsullivan added zDeprecated Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead release_note:fix Team:AppServicesSv v7.16.0 v8.0.0 labels Oct 4, 2021
@elasticmachine
Copy link
Contributor

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

@tsullivan tsullivan force-pushed the reporting/fix-wait-for-render branch from d22df3d to 40a20cb Compare October 4, 2021 22:26
@tsullivan tsullivan marked this pull request as draft October 5, 2021 00:33
@tsullivan
Copy link
Member Author

@elasticmachine merge upstream

@tsullivan tsullivan force-pushed the reporting/fix-wait-for-render branch 3 times, most recently from 6452e75 to 3d6f9d9 Compare October 7, 2021 23:44
@tsullivan tsullivan force-pushed the reporting/fix-wait-for-render branch 2 times, most recently from 1c11553 to 8ed81a8 Compare October 7, 2021 23:58
@tsullivan tsullivan force-pushed the reporting/fix-wait-for-render branch from 8ed81a8 to 8900e24 Compare October 8, 2021 00:01
@tsullivan tsullivan changed the title [Reporting] Add a timeout for waiting for render to complete [Reporting] Revisit handling timeouts for different phases of screenshot capture Oct 8, 2021
@tsullivan
Copy link
Member Author

@elasticmachine merge upstream

@tsullivan
Copy link
Member Author

@elasticmachine merge upstream

Copy link
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 comments @tsullivan , changes LGTM.

@tsullivan
Copy link
Member Author

@elasticmachine merge upstream

@tsullivan
Copy link
Member Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / general / X-Pack API Integration Tests.x-pack/test/api_integration/apis/ml/jobs/categorization_field_examples·ts.apis Machine Learning jobs Categorization example endpoint - invalid, too many tokens.

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has not failed recently on tracked branches

[00:00:00]     │
[00:00:00]       └-: apis
[00:00:00]         └-> "before all" hook in "apis"
[00:11:42]         └-: Machine Learning
[00:11:42]           └-> "before all" hook in "Machine Learning"
[00:11:42]           └-> "before all" hook in "Machine Learning"
[00:11:42]             │ debg creating role ft_ml_source
[00:11:42]             │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [ft_ml_source]
[00:11:42]             │ debg creating role ft_ml_source_readonly
[00:11:42]             │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [ft_ml_source_readonly]
[00:11:42]             │ debg creating role ft_ml_dest
[00:11:42]             │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [ft_ml_dest]
[00:11:42]             │ debg creating role ft_ml_dest_readonly
[00:11:42]             │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [ft_ml_dest_readonly]
[00:11:42]             │ debg creating role ft_ml_ui_extras
[00:11:42]             │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [ft_ml_ui_extras]
[00:11:42]             │ debg creating role ft_default_space_ml_all
[00:11:42]             │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [ft_default_space_ml_all]
[00:11:42]             │ debg creating role ft_default_space1_ml_all
[00:11:42]             │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [ft_default_space1_ml_all]
[00:11:42]             │ debg creating role ft_all_spaces_ml_all
[00:11:42]             │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [ft_all_spaces_ml_all]
[00:11:42]             │ debg creating role ft_default_space_ml_read
[00:11:42]             │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [ft_default_space_ml_read]
[00:11:42]             │ debg creating role ft_default_space1_ml_read
[00:11:42]             │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [ft_default_space1_ml_read]
[00:11:42]             │ debg creating role ft_all_spaces_ml_read
[00:11:42]             │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [ft_all_spaces_ml_read]
[00:11:42]             │ debg creating role ft_default_space_ml_none
[00:11:42]             │ info [o.e.x.s.a.r.TransportPutRoleAction] [node-01] added role [ft_default_space_ml_none]
[00:11:42]             │ debg creating user ft_ml_poweruser
[00:11:42]             │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [ft_ml_poweruser]
[00:11:42]             │ debg created user ft_ml_poweruser
[00:11:42]             │ debg creating user ft_ml_poweruser_spaces
[00:11:42]             │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [ft_ml_poweruser_spaces]
[00:11:42]             │ debg created user ft_ml_poweruser_spaces
[00:11:42]             │ debg creating user ft_ml_poweruser_space1
[00:11:43]             │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [ft_ml_poweruser_space1]
[00:11:43]             │ debg created user ft_ml_poweruser_space1
[00:11:43]             │ debg creating user ft_ml_poweruser_all_spaces
[00:11:43]             │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [ft_ml_poweruser_all_spaces]
[00:11:43]             │ debg created user ft_ml_poweruser_all_spaces
[00:11:43]             │ debg creating user ft_ml_viewer
[00:11:43]             │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [ft_ml_viewer]
[00:11:43]             │ debg created user ft_ml_viewer
[00:11:43]             │ debg creating user ft_ml_viewer_spaces
[00:11:43]             │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [ft_ml_viewer_spaces]
[00:11:43]             │ debg created user ft_ml_viewer_spaces
[00:11:43]             │ debg creating user ft_ml_viewer_space1
[00:11:43]             │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [ft_ml_viewer_space1]
[00:11:43]             │ debg created user ft_ml_viewer_space1
[00:11:43]             │ debg creating user ft_ml_viewer_all_spaces
[00:11:43]             │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [ft_ml_viewer_all_spaces]
[00:11:43]             │ debg created user ft_ml_viewer_all_spaces
[00:11:43]             │ debg creating user ft_ml_unauthorized
[00:11:43]             │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [ft_ml_unauthorized]
[00:11:43]             │ debg created user ft_ml_unauthorized
[00:11:43]             │ debg creating user ft_ml_unauthorized_spaces
[00:11:43]             │ info [o.e.x.s.a.u.TransportPutUserAction] [node-01] added user [ft_ml_unauthorized_spaces]
[00:11:43]             │ debg created user ft_ml_unauthorized_spaces
[00:15:53]           └-: jobs
[00:15:53]             └-> "before all" hook in "jobs"
[00:15:53]             └-: Categorization example endpoint - 
[00:15:53]               └-> "before all" hook for "valid with good number of tokens"
[00:15:53]               └-> "before all" hook for "valid with good number of tokens"
[00:15:53]                 │ info [x-pack/test/functional/es_archives/ml/categorization] Loading "mappings.json"
[00:15:53]                 │ info [x-pack/test/functional/es_archives/ml/categorization] Loading "data.json.gz"
[00:15:53]                 │ info [o.e.c.m.MetadataCreateIndexService] [node-01] [ft_categorization] creating index, cause [api], templates [], shards [1]/[0]
[00:15:53]                 │ info [x-pack/test/functional/es_archives/ml/categorization] Created index "ft_categorization"
[00:15:53]                 │ debg [x-pack/test/functional/es_archives/ml/categorization] "ft_categorization" settings {"index":{"number_of_replicas":"0","number_of_shards":"1"}}
[00:15:54]                 │ info [x-pack/test/functional/es_archives/ml/categorization] Indexed 1501 docs into "ft_categorization"
[00:15:54]                 │ debg applying update to kibana config: {"dateFormat:tz":"UTC"}
[00:15:54]               └-> valid with good number of tokens
[00:15:54]                 └-> "before each" hook: global before each for "valid with good number of tokens"
[00:15:55]                 └- ✓ pass  (156ms)
[00:15:55]               └-> invalid, too many tokens.
[00:15:55]                 └-> "before each" hook: global before each for "invalid, too many tokens."
[00:15:55]                 │ info [r.suppressed] [node-01] path: /_analyze, params: {}
[00:15:55]                 │      org.elasticsearch.transport.RemoteTransportException: [node-01][127.0.0.1:63111][indices:admin/analyze[s]]
[00:15:55]                 │      Caused by: java.lang.IllegalStateException: The number of tokens produced by calling _analyze has exceeded the allowed maximum of [10000]. This limit can be set by changing the [index.analyze.max_token_count] index level setting.
[00:15:55]                 │      	at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction$TokenCounter.increment(TransportAnalyzeAction.java:397) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:15:55]                 │      	at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.simpleAnalyze(TransportAnalyzeAction.java:229) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:15:55]                 │      	at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.analyze(TransportAnalyzeAction.java:204) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:15:55]                 │      	at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.analyze(TransportAnalyzeAction.java:122) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:15:55]                 │      	at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:110) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:15:55]                 │      	at org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction.shardOperation(TransportAnalyzeAction.java:62) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:15:55]                 │      	at org.elasticsearch.action.support.single.shard.TransportSingleShardAction.lambda$asyncShardOperation$0(TransportSingleShardAction.java:99) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:15:55]                 │      	at org.elasticsearch.action.ActionRunnable.lambda$supply$0(ActionRunnable.java:47) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:15:55]                 │      	at org.elasticsearch.action.ActionRunnable$2.doRun(ActionRunnable.java:62) ~[elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:15:55]                 │      	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:737) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:15:55]                 │      	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26) [elasticsearch-8.0.0-SNAPSHOT.jar:8.0.0-SNAPSHOT]
[00:15:55]                 │      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
[00:15:55]                 │      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
[00:15:55]                 │      	at java.lang.Thread.run(Thread.java:833) [?:?]
[00:15:55]                 └- ✖ fail: apis Machine Learning jobs Categorization example endpoint -  invalid, too many tokens.
[00:15:55]                 │       Error: expected 'partially_valid' to sort of equal 'invalid'
[00:15:55]                 │       + expected - actual
[00:15:55]                 │ 
[00:15:55]                 │       -partially_valid
[00:15:55]                 │       +invalid
[00:15:55]                 │       
[00:15:55]                 │       at Assertion.assert (/dev/shm/workspace/parallel/11/kibana/node_modules/@kbn/expect/expect.js:100:11)
[00:15:55]                 │       at Assertion.eql (/dev/shm/workspace/parallel/11/kibana/node_modules/@kbn/expect/expect.js:244:8)
[00:15:55]                 │       at Context.<anonymous> (test/api_integration/apis/ml/jobs/categorization_field_examples.ts:302:44)
[00:15:55]                 │       at runMicrotasks (<anonymous>)
[00:15:55]                 │       at processTicksAndRejections (node:internal/process/task_queues:96:5)
[00:15:55]                 │       at Object.apply (/dev/shm/workspace/parallel/11/kibana/node_modules/@kbn/test/target_node/functional_test_runner/lib/mocha/wrap_function.js:87:16)
[00:15:55]                 │ 
[00:15:55]                 │ 

Stack Trace

Error: expected 'partially_valid' to sort of equal 'invalid'
    at Assertion.assert (/dev/shm/workspace/parallel/11/kibana/node_modules/@kbn/expect/expect.js:100:11)
    at Assertion.eql (/dev/shm/workspace/parallel/11/kibana/node_modules/@kbn/expect/expect.js:244:8)
    at Context.<anonymous> (test/api_integration/apis/ml/jobs/categorization_field_examples.ts:302:44)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Object.apply (/dev/shm/workspace/parallel/11/kibana/node_modules/@kbn/test/target_node/functional_test_runner/lib/mocha/wrap_function.js:87:16) {
  actual: 'partially_valid',
  expected: 'invalid',
  showDiff: true
}

Metrics [docs]

✅ unchanged

History

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

@tsullivan tsullivan merged commit 584d09e into elastic:master Oct 18, 2021
@tsullivan tsullivan deleted the reporting/fix-wait-for-render branch October 18, 2021 17:24
tsullivan added a commit to tsullivan/kibana that referenced this pull request Oct 18, 2021
…hot capture (elastic#113807)

* [Reporting] Revisit handling timeouts for different phases of screenshot capture

* remove translations for changed text

* add wip unit test

* simplify class

* todo more testing

* fix ts

* update snapshots

* simplify open_url

* fixup me

* move setupPage to a method of the ObservableHandler class

* do not pass entire config object to helper functions

* distinguish internal timeouts vs external timeout

* add tests for waitUntil

* checkIsPageOpen test

* restore passing of renderErrors

* updates per feedback

* Update x-pack/plugins/reporting/server/lib/screenshots/observable_handler.ts

Co-authored-by: Michael Dokolin <dokmic@gmail.com>

* Update x-pack/plugins/reporting/server/lib/screenshots/observable_handler.ts

Co-authored-by: Michael Dokolin <dokmic@gmail.com>

* Update x-pack/plugins/reporting/server/lib/screenshots/observable_handler.ts

Co-authored-by: Michael Dokolin <dokmic@gmail.com>

* Update x-pack/plugins/reporting/server/lib/screenshots/observable_handler.ts

Co-authored-by: Michael Dokolin <dokmic@gmail.com>

* Update x-pack/plugins/reporting/server/lib/screenshots/observable_handler.ts

Co-authored-by: Michael Dokolin <dokmic@gmail.com>

* fix parsing

* apply simplifications consistently

* dont main waitUntil a higher order component

* resolve the timeouts options outside of the service

* comment correction

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Michael Dokolin <dokmic@gmail.com>
tsullivan added a commit that referenced this pull request Oct 18, 2021
…hot capture (#113807) (#115418)

* [Reporting] Revisit handling timeouts for different phases of screenshot capture

* remove translations for changed text

* add wip unit test

* simplify class

* todo more testing

* fix ts

* update snapshots

* simplify open_url

* fixup me

* move setupPage to a method of the ObservableHandler class

* do not pass entire config object to helper functions

* distinguish internal timeouts vs external timeout

* add tests for waitUntil

* checkIsPageOpen test

* restore passing of renderErrors

* updates per feedback

* Update x-pack/plugins/reporting/server/lib/screenshots/observable_handler.ts

Co-authored-by: Michael Dokolin <dokmic@gmail.com>

* Update x-pack/plugins/reporting/server/lib/screenshots/observable_handler.ts

Co-authored-by: Michael Dokolin <dokmic@gmail.com>

* Update x-pack/plugins/reporting/server/lib/screenshots/observable_handler.ts

Co-authored-by: Michael Dokolin <dokmic@gmail.com>

* Update x-pack/plugins/reporting/server/lib/screenshots/observable_handler.ts

Co-authored-by: Michael Dokolin <dokmic@gmail.com>

* Update x-pack/plugins/reporting/server/lib/screenshots/observable_handler.ts

Co-authored-by: Michael Dokolin <dokmic@gmail.com>

* fix parsing

* apply simplifications consistently

* dont main waitUntil a higher order component

* resolve the timeouts options outside of the service

* comment correction

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Michael Dokolin <dokmic@gmail.com>

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

Labels

release_note:fix v7.16.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.

[Reporting] the timeouts.renderComplete setting does not trigger while waiting for rendering

5 participants