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

[Lens] Fix Metric visualization scale #113956

Merged
merged 9 commits into from
Oct 12, 2021
Merged

[Lens] Fix Metric visualization scale #113956

merged 9 commits into from
Oct 12, 2021

Conversation

dej611
Copy link
Contributor

@dej611 dej611 commented Oct 5, 2021

Summary

Fix #113733

Recompute the container scale on value change to have it always fit in the preview box, dashboard and all cases.

With the fix:

Screenshot 2021-10-05 at 17 52 34

Screenshot 2021-10-05 at 17 52 42

Without the fix:

Screenshot 2021-10-05 at 17 55 01

Screenshot 2021-10-05 at 17 55 09

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

@dej611 dej611 added Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.0.0 Feature:Lens auto-backport Deprecated - use backport:version if exact versions are needed v7.16.0 release_note:fix labels Oct 5, 2021
@dej611 dej611 marked this pull request as ready for review October 6, 2021 07:54
@dej611 dej611 requested a review from a team as a code owner October 6, 2021 07:54
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-vis-editors (Team:VisEditors)

@flash1293
Copy link
Contributor

Why do we only need this for the preview version? Seems like the regular metric can run into the same issue (e.g. on a dashboard with a small panel)

@dej611
Copy link
Contributor Author

dej611 commented Oct 6, 2021

Initially I thought to fix it everywhere, but I thought that the likelihood of this bug to happen in a dashboard with many metrics is much lower (the panel must be smaller than 300px on average and numbers must have many digits) than the performance hit it may occur (reading clientWidth triggers a reflow).
Previews are a small limited set usually.

But changing it back is very simple if required.

@flash1293
Copy link
Contributor

Metrics can absolutely be smaller than 300px on a dashboard. If we have reservations due to performance reasons, we should improve performance for all cases.

@dej611
Copy link
Contributor Author

dej611 commented Oct 6, 2021

Updated fix to support all scenarios, not just previews.

@dej611
Copy link
Contributor Author

dej611 commented Oct 7, 2021

@elasticmachine merge upstream

@dej611
Copy link
Contributor Author

dej611 commented Oct 7, 2021

@elasticmachine merge upstream

@dej611
Copy link
Contributor Author

dej611 commented Oct 7, 2021

@elasticmachine merge upstream

@dej611
Copy link
Contributor Author

dej611 commented Oct 7, 2021

@elasticmachine merge upstream

@dej611
Copy link
Contributor Author

dej611 commented Oct 11, 2021

@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/search/session·ts.apis search search session touched time updates when you poll on an search

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:00:00]                     └-: search
[00:00:00]                       └-> "before all" hook in "search"
[00:00:03]                       └-: search session
[00:00:03]                         └-> "before all" hook for "should fail to extend a nonexistent session"
[00:00:03]                         └-> should fail to extend a nonexistent session
[00:00:03]                           └-> "before each" hook: global before each for "should fail to extend a nonexistent session"
[00:00:03]                           │ proc [kibana] [2021-10-11T09:04:54.789+00:00][ERROR][plugins.dataEnhanced.data_enhanced] [object Object]
[00:00:03]                           └- ✓ pass  (82ms) "apis search search session should fail to extend a nonexistent session"
[00:00:03]                         └-> should sync search ids into not persisted session
[00:00:03]                           └-> "before each" hook: global before each for "should sync search ids into not persisted session"
[00:00:03]                           │ debg Waiting up to 5000ms for searches persisted into session...
[00:00:03]                           │ proc [kibana] [2021-10-11T09:04:54.955+00:00][ERROR][plugins.dataEnhanced.data_enhanced] [object Object]
[00:00:03]                           │ debg --- retry.waitForWithTimeout error: expected 200 "OK", got 404 "Not Found"
[00:00:03]                           │ proc [kibana] [2021-10-11T09:04:55.530+00:00][ERROR][plugins.dataEnhanced.data_enhanced] [object Object]
[00:00:03]                           │ debg --- retry.waitForWithTimeout failed again with the same message...
[00:00:04]                           │ info [o.e.c.m.MetadataMappingService] [node-01] [.kibana_8.0.0_001/OVSuf4FoQ2OMRHlkUp6h8A] update_mapping [_doc]
[00:00:04]                           └- ✓ pass  (1.3s) "apis search search session should sync search ids into not persisted session"
[00:00:04]                         └-> should complete session when searches complete
[00:00:04]                           └-> "before each" hook: global before each for "should complete session when searches complete"
[00:00:05]                           │ debg Waiting up to 5000ms for searches persisted into session...
[00:00:05]                           │ debg --- retry.waitForWithTimeout error: expected [] to contain 'FnJJVDRmdVhUU2hhbGlHVUdrYUFodEEbdHF1ODhYNFpSdEtiMXZGVlVkZzFwUToyMjI5'
[00:00:05]                           │ debg --- retry.waitForWithTimeout failed again with the same message...
[00:00:08]                           │ info [o.e.c.m.MetadataMappingService] [node-01] [.kibana_8.0.0_001/OVSuf4FoQ2OMRHlkUp6h8A] update_mapping [_doc]
[00:00:16]                           │ debg Waiting up to 5000ms for searches eventually complete and session gets into the complete state...
[00:00:16]                           └- ✓ pass  (11.6s) "apis search search session should complete session when searches complete"
[00:00:16]                         └-> touched time updates when you poll on an search
[00:00:16]                           └-> "before each" hook: global before each for "touched time updates when you poll on an search"
[00:00:16]                           │ debg Waiting up to 20000ms for search session created...
[00:00:16]                           │ proc [kibana] [2021-10-11T09:05:07.783+00:00][ERROR][plugins.dataEnhanced.data_enhanced] [object Object]
[00:00:16]                           │ proc [kibana] [2021-10-11T09:05:08.344+00:00][ERROR][plugins.dataEnhanced.data_enhanced] [object Object]
[00:00:20]                           └- ✖ fail: apis search search session touched time updates when you poll on an search
[00:00:20]                           │      Error: expected '2021-10-11T09:05:08.765Z' to be below 2021-10-11T09:05:08.765Z
[00:00:20]                           │       at Assertion.assert (/dev/shm/workspace/parallel/10/kibana/node_modules/@kbn/expect/expect.js:100:11)
[00:00:20]                           │       at Assertion.lessThan.Assertion.below (/dev/shm/workspace/parallel/10/kibana/node_modules/@kbn/expect/expect.js:336:8)
[00:00:20]                           │       at Function.lessThan (/dev/shm/workspace/parallel/10/kibana/node_modules/@kbn/expect/expect.js:531:15)
[00:00:20]                           │       at Context.<anonymous> (test/api_integration/apis/search/session.ts:438:65)
[00:00:20]                           │       at runMicrotasks (<anonymous>)
[00:00:20]                           │       at processTicksAndRejections (internal/process/task_queues.js:95:5)
[00:00:20]                           │       at Object.apply (/dev/shm/workspace/parallel/10/kibana/node_modules/@kbn/test/target_node/functional_test_runner/lib/mocha/wrap_function.js:87:16)
[00:00:20]                           │ 
[00:00:20]                           │ 

Stack Trace

Error: expected '2021-10-11T09:05:08.765Z' to be below 2021-10-11T09:05:08.765Z
    at Assertion.assert (/dev/shm/workspace/parallel/10/kibana/node_modules/@kbn/expect/expect.js:100:11)
    at Assertion.lessThan.Assertion.below (/dev/shm/workspace/parallel/10/kibana/node_modules/@kbn/expect/expect.js:336:8)
    at Function.lessThan (/dev/shm/workspace/parallel/10/kibana/node_modules/@kbn/expect/expect.js:531:15)
    at Context.<anonymous> (test/api_integration/apis/search/session.ts:438:65)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at Object.apply (/dev/shm/workspace/parallel/10/kibana/node_modules/@kbn/test/target_node/functional_test_runner/lib/mocha/wrap_function.js:87:16)

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
lens 1.0MB 1.0MB +3.0B

History

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

@flash1293
Copy link
Contributor

Seems like it doesn't work for all cases?
Screenshot 2021-10-11 at 15 54 46

Is this the MIN_SCALE at work? If yes looks good to me 👍

@dej611
Copy link
Contributor Author

dej611 commented Oct 11, 2021

I think so, but will double check for safety.

@dej611
Copy link
Contributor Author

dej611 commented Oct 12, 2021

I can reproduce that scenario only reaching MIN_SCALE, and always in the preview box. In the charting panel it was really hard and didn't try in the dashboard, but I suspect so.

@dej611 dej611 merged commit fa69602 into elastic:master Oct 12, 2021
@dej611 dej611 deleted the fix/113733 branch October 12, 2021 15:33
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Oct 12, 2021
* 🐛 Fix metric rescale

* 📸 Restored old snapshots

* 🐛 Extend the fix to all scenarios

* 📸 Refresh snapshots for new fix

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Oct 12, 2021
* 🐛 Fix metric rescale

* 📸 Restored old snapshots

* 🐛 Extend the fix to all scenarios

* 📸 Refresh snapshots for new fix

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

Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Lens release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Metric suggestions are not rescaled based on actual fit
4 participants