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] Automatically enable show array values for non-numeric runtime fields #149025

Merged
merged 3 commits into from Jan 18, 2023

Conversation

dej611
Copy link
Contributor

@dej611 dej611 commented Jan 17, 2023

Summary

Fixes #148613

After investigating the issue via a different approach #149011 I've decided to handle it in this minimal way.
This PR will automatically switch the show_array toggle for non numeric fields avoiding as much as possible direct appearance of the error to the user.
If the user decides to explicitly disable the toggle, then the runtime error will be shown (the message there can still be improved).

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 release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure Feature:Lens v8.7.0 labels Jan 17, 2023
@dej611 dej611 requested a review from a team as a code owner January 17, 2023 12:02
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-visualizations @elastic/kibana-visualizations-external (Team:Visualizations)

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

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.3MB 1.3MB +77.0B

History

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

Copy link
Contributor

@drewdaemon drewdaemon left a comment

Choose a reason for hiding this comment

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

Works well. I understand that this is quite an edge case so I'm not sure how much effort it's worth to polish it. That said, have you considered disabling the toggle in this case? I'm not sure why it's useful to the user to be able to turn show array values off when we know it's going to cause an error.

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

This works fine, it seems from the documentation that top metrics doesn't work well with array values https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-metrics-top-metrics.html so it makes sense to me.
The error message is very confusing though. We can improve the UI either with a better error message or following Andrew's suggestion. I don't have a preference. With that being said, I am fine as it is now, we can always see if this confuses our users and improve.

@dej611
Copy link
Contributor Author

dej611 commented Jan 18, 2023

That said, have you considered disabling the toggle in this case? I'm not sure why it's useful to the user to be able to turn show array values off when we know it's going to cause an error.

On one hand that would make it easier to maintain, on the other hand if user knows the runtime field is not returning an array, then they would pay a perf toll for the request.

The error message is very confusing though. We can improve the UI either with a better error message or following Andrew's suggestion. I don't have a preference. With that being said, I am fine as it is now, we can always see if this confuses our users and improve.

I agree the error message is very confusing, but fixing it properly requires quite some code to add - as for the linked closed PR - which I would delay right now.
My idea is to fix 99% of the issue with this simple PR and then take care of the remaining bits thinking carefully on how to do it right.

@stratoula
Copy link
Contributor

Agree, let's merge

@dej611 dej611 merged commit aa66f9a into elastic:main Jan 18, 2023
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Lens release_note:fix Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Runtime fields returning array returns a Request error when using last_value operation
6 participants