Skip to content

[ES|QL] [Discover] Keeps the preferred chart configuration when possible#197453

Merged
stratoula merged 50 commits intoelastic:mainfrom
stratoula:keep-vis-config-esql
Nov 5, 2024
Merged

[ES|QL] [Discover] Keeps the preferred chart configuration when possible#197453
stratoula merged 50 commits intoelastic:mainfrom
stratoula:keep-vis-config-esql

Conversation

@stratoula
Copy link
Copy Markdown
Contributor

@stratoula stratoula commented Oct 23, 2024

Summary

Closes #184631

It keeps the chart configuration when the user is doing actions compatible with the current query such as:

  • Adding a where filter (by clicking the table, the sidebar, the chart)
  • Changes the breakdown field and the field type is compatible with the current chart
  • Changing to a compatible chart type (from example from bar to line or pie to treemap)
  • Changing the query that doesnt affect the generated columns mapped to a chart. For example adding a limit or creating a runtime field etc.

The logic depends on the suggestions. If the suggestions return the preferred chart type, then we are going to use this. So it really depends on the api and the type / number of columns. It is as smarter as it can in order to not create bugs. I am quite happy with the result. It is much better than what we have so far.

meow

Next steps

I would love to do the same on the dahsboard too, needs more time though. But the changes made here will def work in favor

Checklist

@stratoula stratoula changed the title Keep vis config esql [ES|QL] [Discover] Keeps the preferred chart configuration when possible Oct 25, 2024
changeType: TableChangeType;
keptLayerIds: string[];
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I moved this here as it is used in many places already

Comment thread src/plugins/unified_histogram/public/services/lens_vis_service.ts
@stratoula stratoula mentioned this pull request Nov 5, 2024
74 tasks
Copy link
Copy Markdown
Contributor

@markov00 markov00 left a comment

Choose a reason for hiding this comment

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

Approving but please consider the comment I've left above

Comment thread src/plugins/unified_histogram/public/services/lens_vis_service.ts
@markov00 markov00 requested review from markov00 and mbondyra November 5, 2024 11:23
@stratoula stratoula enabled auto-merge (squash) November 5, 2024 11:35
@stratoula stratoula disabled auto-merge November 5, 2024 11:55
Comment thread packages/kbn-visualization-utils/src/map_vis_to_chart_type.ts Outdated
Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
Comment thread packages/kbn-visualization-utils/src/map_vis_to_chart_type.ts
Comment thread x-pack/plugins/lens/public/lens_suggestions_api/helpers.ts
Comment thread packages/kbn-visualization-utils/src/map_vis_to_chart_type.ts
@stratoula stratoula enabled auto-merge (squash) November 5, 2024 17:06
@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Nov 5, 2024

💛 Build succeeded, but was flaky

  • Buildkite Build
  • Commit: 4fad39b
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-197453-4fad39b1269a

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
aiops 584 587 +3
apm 1882 1885 +3
charts 126 129 +3
cloudSecurityPosture 659 662 +3
dashboard 675 678 +3
dataVisualizer 729 732 +3
discover 1015 1018 +3
esqlDataGrid 368 371 +3
eventAnnotationListing 583 586 +3
expressionHeatmap 179 182 +3
expressionMetricVis 112 115 +3
expressionPartitionVis 193 196 +3
expressionTagcloud 167 170 +3
expressionXY 254 257 +3
graph 300 303 +3
investigateApp 579 582 +3
lens 1468 1472 +4
logsExplorer 568 571 +3
logsShared 700 703 +3
ml 2013 2016 +3
observability 1067 1070 +3
observabilityAIAssistantApp 381 384 +3
securitySolution 6146 6149 +3
slo 853 856 +3
transform 504 507 +3
triggersActionsUi 850 853 +3
unifiedHistogram 190 193 +3
visDefaultEditor 203 206 +3
visTypeTimelion 63 66 +3
visTypeTimeseries 459 462 +3
total +91

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
@kbn/visualization-utils 17 22 +5
lens 590 591 +1
total +6

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.5MB 1.5MB +860.0B
observabilityAIAssistantApp 239.1KB 239.2KB +53.0B
unifiedHistogram 70.1KB 71.0KB +975.0B
total +1.8KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
lens 63 62 -1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
lens 50.8KB 50.8KB +27.0B
unifiedHistogram 10.1KB 10.5KB +413.0B
total +440.0B
Unknown metric groups

API count

id before after diff
@kbn/visualization-utils 19 24 +5
lens 692 693 +1
total +6

History

@stratoula stratoula merged commit ccbcab9 into elastic:main Nov 5, 2024
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11693873531

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 5, 2024
…ble (elastic#197453)

## Summary

Closes elastic#184631

It keeps the chart configuration when the user is doing actions
compatible with the current query such as:

- Adding a where filter (by clicking the table, the sidebar, the chart)
- Changes the breakdown field and the field type is compatible with the
current chart
- Changing to a compatible chart type (from example from bar to line or
pie to treemap)
- Changing the query that doesnt affect the generated columns mapped to
a chart. For example adding a limit or creating a runtime field etc.

The logic depends on the suggestions. If the suggestions return the
preferred chart type, then we are going to use this. So it really
depends on the api and the type / number of columns. It is as smarter as
it can in order to not create bugs. I am quite happy with the result. It
is much better than what we have so far.

![meow](https://github.com/user-attachments/assets/c4249e5e-e785-4e57-8651-d1f660f5a61a)

### Next steps
I would love to do the same on the dahsboard too, needs more time
though. But the changes made here will def work in favor

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

---------

Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
(cherry picked from commit ccbcab9)
@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 6, 2024
… possible (#197453) (#199069)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ES|QL] [Discover] Keeps the preferred chart configuration when
possible (#197453)](#197453)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Stratoula
Kalafateli","email":"efstratia.kalafateli@elastic.co"},"sourceCommit":{"committedDate":"2024-11-05T22:56:17Z","message":"[ES|QL]
[Discover] Keeps the preferred chart configuration when possible
(#197453)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/184631\r\n\r\nIt keeps the
chart configuration when the user is doing actions\r\ncompatible with
the current query such as:\r\n\r\n- Adding a where filter (by clicking
the table, the sidebar, the chart)\r\n- Changes the breakdown field and
the field type is compatible with the\r\ncurrent chart\r\n- Changing to
a compatible chart type (from example from bar to line or\r\npie to
treemap)\r\n- Changing the query that doesnt affect the generated
columns mapped to\r\na chart. For example adding a limit or creating a
runtime field etc.\r\n\r\nThe logic depends on the suggestions. If the
suggestions return the\r\npreferred chart type, then we are going to use
this. So it really\r\ndepends on the api and the type / number of
columns. It is as smarter as\r\nit can in order to not create bugs. I am
quite happy with the result. It\r\nis much better than what we have so
far.\r\n\r\n\r\n![meow](https://github.com/user-attachments/assets/c4249e5e-e785-4e57-8651-d1f660f5a61a)\r\n\r\n###
Next steps\r\nI would love to do the same on the dahsboard too, needs
more time\r\nthough. But the changes made here will def work in
favor\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
Marta Bondyra
<4283304+mbondyra@users.noreply.github.com>","sha":"ccbcab9623af4df0bdccb0e3e194b8484d2161a1","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Discover","enhancement","v9.0.0","release_note:feature","Team:Obs
AI
Assistant","Feature:ES|QL","ci:project-deploy-observability","backport:version","v8.17.0"],"title":"[ES|QL]
[Discover] Keeps the preferred chart configuration when
possible","number":197453,"url":"https://github.com/elastic/kibana/pull/197453","mergeCommit":{"message":"[ES|QL]
[Discover] Keeps the preferred chart configuration when possible
(#197453)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/184631\r\n\r\nIt keeps the
chart configuration when the user is doing actions\r\ncompatible with
the current query such as:\r\n\r\n- Adding a where filter (by clicking
the table, the sidebar, the chart)\r\n- Changes the breakdown field and
the field type is compatible with the\r\ncurrent chart\r\n- Changing to
a compatible chart type (from example from bar to line or\r\npie to
treemap)\r\n- Changing the query that doesnt affect the generated
columns mapped to\r\na chart. For example adding a limit or creating a
runtime field etc.\r\n\r\nThe logic depends on the suggestions. If the
suggestions return the\r\npreferred chart type, then we are going to use
this. So it really\r\ndepends on the api and the type / number of
columns. It is as smarter as\r\nit can in order to not create bugs. I am
quite happy with the result. It\r\nis much better than what we have so
far.\r\n\r\n\r\n![meow](https://github.com/user-attachments/assets/c4249e5e-e785-4e57-8651-d1f660f5a61a)\r\n\r\n###
Next steps\r\nI would love to do the same on the dahsboard too, needs
more time\r\nthough. But the changes made here will def work in
favor\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
Marta Bondyra
<4283304+mbondyra@users.noreply.github.com>","sha":"ccbcab9623af4df0bdccb0e3e194b8484d2161a1"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197453","number":197453,"mergeCommit":{"message":"[ES|QL]
[Discover] Keeps the preferred chart configuration when possible
(#197453)\n\n## Summary\r\n\r\nCloses
https://github.com/elastic/kibana/issues/184631\r\n\r\nIt keeps the
chart configuration when the user is doing actions\r\ncompatible with
the current query such as:\r\n\r\n- Adding a where filter (by clicking
the table, the sidebar, the chart)\r\n- Changes the breakdown field and
the field type is compatible with the\r\ncurrent chart\r\n- Changing to
a compatible chart type (from example from bar to line or\r\npie to
treemap)\r\n- Changing the query that doesnt affect the generated
columns mapped to\r\na chart. For example adding a limit or creating a
runtime field etc.\r\n\r\nThe logic depends on the suggestions. If the
suggestions return the\r\npreferred chart type, then we are going to use
this. So it really\r\ndepends on the api and the type / number of
columns. It is as smarter as\r\nit can in order to not create bugs. I am
quite happy with the result. It\r\nis much better than what we have so
far.\r\n\r\n\r\n![meow](https://github.com/user-attachments/assets/c4249e5e-e785-4e57-8651-d1f660f5a61a)\r\n\r\n###
Next steps\r\nI would love to do the same on the dahsboard too, needs
more time\r\nthough. But the changes made here will def work in
favor\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n\r\n---------\r\n\r\nCo-authored-by:
Marta Bondyra
<4283304+mbondyra@users.noreply.github.com>","sha":"ccbcab9623af4df0bdccb0e3e194b8484d2161a1"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
@IanLee1521
Copy link
Copy Markdown

I came across this in the release notes for 8.17 and I've definitely been bitten by this before. Looking forward to trying this out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels ci:project-deploy-observability Create an Observability project enhancement New value added to drive a business result Feature:Discover Discover Application Feature:ES|QL ES|QL related features in Kibana release_note:feature Makes this part of the condensed release notes Team:Obs AI Assistant Observability AI Assistant v8.17.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Discover][ES|QL] Filtering by clicking should keep the selected chart type

8 participants