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

[Dashboard][Saved Object Tagging] Fix Duplicating Tags #119079

Merged
merged 3 commits into from
Nov 19, 2021

Conversation

ThomThomson
Copy link
Contributor

@ThomThomson ThomThomson commented Nov 18, 2021

Summary

Fixes #118796

What is this bug?

References from by Value Visualizations should be extracted into the dashboard saved object in order for exporting to get the correct references. In 7.13.0 a system was added which prefixes each reference with the panel ID it came from, so that it can be matched up with the proper panel.

In the dashboard inject function, references are filtered for each panel by reading the panel id from the prefix. As a fallback, if no references are found matching that panel, all references from the dashboard are passed to the inject function for the associated embeddable type.

This fallback assumes that the inject function for the embeddable type is capable of determining which references are relevant to it, and only injecting those references. Unfortunately, the Lens inject function would copy over all references it was given.

Because by value Lens Panels existed in 7.12 without the prefixing system of subsequent versions, importing a dashboard with a by value Lens from 7.12.1 into a later version resulted in every reference from the dashboard existing in every lens panel. This included any tag references on the dashboard.

When extracting these references for saving, every lens panel would add its own version of the tag, prefixed with its embeddable id. Additionally, the tag extract system wasn't de-duping tags, because theoretically there should never be duplicates. This all resulted in an addition of a number of tags directly relating to the number of by value Lens Panels in the dashboard every time the dashboard was saved.

What is the fix?

Firstly, the Lens inject function now uses its own internal references to match names on any references given to it during inject. This way, only relevant references are injected into the Lens panels. This stops the tags from duplicating, and stops the entire problem in its tracks when a dashboard is imported or migrated from 7.12.1.

Unfortunately, that fix cannot clean up any dashboards which have already suffered from the duplication problem, so a quick de-duping step was added to the tags extract function. Additionally, the dashboard extract function filters out any tags which mistakenly got added into the panel references.

@ThomThomson ThomThomson added Feature:Dashboard Dashboard related features release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas loe:medium Medium Level of Effort v8.0.0 impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Feature:Saved Object Tagging Saved Objects Tagging feature v7.16.0 v8.1.0 labels Nov 18, 2021
Copy link
Contributor

@crob611 crob611 left a comment

Choose a reason for hiding this comment

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

Looks good. Nice job tracking that down.

@ThomThomson
Copy link
Contributor Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Page load bundle

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

id before after diff
dashboard 64.5KB 64.6KB +28.0B
lens 44.0KB 44.1KB +147.0B
savedObjectsTaggingOss 2.4KB 2.4KB +14.0B
total +189.0B

History

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

@ThomThomson ThomThomson marked this pull request as ready for review November 19, 2021 02:06
@ThomThomson ThomThomson requested review from a team as code owners November 19, 2021 02:06
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Tested and Lens references are filtered correctly, LGTM

Copy link
Contributor

@pgayvallet pgayvallet left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for tracking that on down.

@ThomThomson ThomThomson merged commit f51f30e into elastic:main Nov 19, 2021
ThomThomson added a commit to ThomThomson/kibana that referenced this pull request Nov 19, 2021
Fix duplicating tags after importing from 7.12
ThomThomson added a commit to ThomThomson/kibana that referenced this pull request Nov 19, 2021
Fix duplicating tags after importing from 7.12
ThomThomson added a commit to ThomThomson/kibana that referenced this pull request Nov 19, 2021
Fix duplicating tags after importing from 7.12
# Conflicts:
#	x-pack/plugins/lens/common/embeddable_factory/index.ts
ThomThomson added a commit that referenced this pull request Nov 19, 2021
…9185)

Fix duplicating tags after importing from 7.12

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
ThomThomson added a commit that referenced this pull request Nov 19, 2021
ThomThomson added a commit that referenced this pull request Nov 19, 2021
… (#119188)

* [Dashboard][Saved Object Tagging] Fix Duplicating Tags (#119079)

Fix duplicating tags after importing from 7.12
# Conflicts:
#	x-pack/plugins/lens/common/embeddable_factory/index.ts

* match 7.15 linting rules
TinLe pushed a commit to TinLe/kibana that referenced this pull request Nov 20, 2021
dmlemeshko pushed a commit that referenced this pull request Nov 29, 2021
Fix duplicating tags after importing from 7.12
KOTungseth added a commit to KOTungseth/kibana that referenced this pull request Nov 29, 2021
KOTungseth added a commit that referenced this pull request Dec 6, 2021
* [DOCS] Adds 7.16.0 release notes

* Updates aggregation-based link

* Updates aggregation-based link

* Updates aggregation-based link

* Updates aggregation-based link

* Adds #119079 to bug fixes

* Updates aggregation-based link

* Link fix

* Update docs/CHANGELOG.asciidoc

Co-authored-by: Greg Back <1045796+gtback@users.noreply.github.com>

* Fixes breaking changes links

* Adds Osquery breaking change

* Links

* Edits ML PR list

* More ML edits

* Updates with review comments

* Removes #111676

* Update docs/CHANGELOG.asciidoc

Co-authored-by: DeDe Morton <dede.morton@elastic.co>

* Update docs/CHANGELOG.asciidoc

Co-authored-by: DeDe Morton <dede.morton@elastic.co>

* Update docs/CHANGELOG.asciidoc

Co-authored-by: DeDe Morton <dede.morton@elastic.co>

* Update docs/CHANGELOG.asciidoc

Co-authored-by: DeDe Morton <dede.morton@elastic.co>

* Update docs/CHANGELOG.asciidoc

Co-authored-by: DeDe Morton <dede.morton@elastic.co>

* Observability review comments

* Update docs/CHANGELOG.asciidoc

Co-authored-by: Brandon Morelli <bmorelli25@gmail.com>

* Update docs/CHANGELOG.asciidoc

Co-authored-by: Brandon Morelli <bmorelli25@gmail.com>

* Update docs/CHANGELOG.asciidoc

Co-authored-by: Brandon Morelli <bmorelli25@gmail.com>

* Update docs/CHANGELOG.asciidoc

Co-authored-by: Brandon Morelli <bmorelli25@gmail.com>

* Fixes deprecation link

Co-authored-by: Greg Back <1045796+gtback@users.noreply.github.com>
Co-authored-by: lcawl <lcawley@elastic.co>
Co-authored-by: DeDe Morton <dede.morton@elastic.co>
Co-authored-by: Brandon Morelli <bmorelli25@gmail.com>
gbamparop pushed a commit to gbamparop/kibana that referenced this pull request Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Dashboard Dashboard related features Feature:Saved Object Tagging Saved Objects Tagging feature impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v7.15.3 v7.16.0 v8.0.0 v8.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Saved Object Tagging] Tags Duplicating After Import
7 participants