-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Conversation
There was a problem hiding this 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.
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]Page load bundle
History
To update your PR or re-run it, just comment with: |
Pinging @elastic/kibana-presentation (Team:Presentation) |
There was a problem hiding this 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
There was a problem hiding this 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.
Fix duplicating tags after importing from 7.12
Fix duplicating tags after importing from 7.12
Fix duplicating tags after importing from 7.12 # Conflicts: # x-pack/plugins/lens/common/embeddable_factory/index.ts
Fix duplicating tags after importing from 7.12
Fix duplicating tags after importing from 7.12
* [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>
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.