[streams][content pack] track installed content packs#218785
[streams][content pack] track installed content packs#218785klacabane merged 18 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/obs-entities (Team:obs-entities) |
flash1293
left a comment
There was a problem hiding this comment.
I tested with this and it generally works fine for dashboards without references.
However for referenced saved objects I'm not sure whether the current behavior makes sense. I have a dashboard that has the following references (twice the same data view and once a library visualization):
{
"name": "6d1cb3a3-08c9-4427-a741-ecaa2b0d9149:panel_6d1cb3a3-08c9-4427-a741-ecaa2b0d9149",
"type": "lens",
"id": "5ca48846-63ea-446a-8f3f-17de9262d482"
},
{
"type": "index-pattern",
"id": "6fd421f2-547c-4d9a-b946-62e078631f91",
"name": "8b18d450-266e-44f1-a520-037d0769e47f:indexpattern-datasource-layer-6d821e87-a35a-4404-968a-cca57c45c7c0"
},
{
"type": "index-pattern",
"id": "6fd421f2-547c-4d9a-b946-62e078631f91",
"name": "6d1cb3a3-08c9-4427-a741-ecaa2b0d9149:indexpattern-datasource-layer-a18791e3-bd58-4483-bdd5-ffd15b625311"
}
The library visualization is just ignored as part of the content pack, which works as intended AFAIK (if the library vis is there, it works fine, if not, the panel won't render correctly).
For the referenced data view however the following is generated in the content pack:
"references": [
{
"source_id": "5ca48846-63ea-446a-8f3f-17de9262d482",
"target_id": "0ec88155-c330-4e61-b351-99e3c61cd1e8"
},
{
"source_id": "6fd421f2-547c-4d9a-b946-62e078631f91",
"target_id": "e143357c-fecb-452f-b891-0a47b5ec038c"
},
{
"source_id": "6fd421f2-547c-4d9a-b946-62e078631f91",
"target_id": "c8402171-24cc-474c-a8fd-7203987a3b04"
}
]
- The non-resolved vis library panel is listed here (does that make sense)?
- The same data view is listed twice - only one saved object is actually created (the first one)
- Should it even create it or reference the existing data view that is already present?
- Should it deduplicate so only one reference is tracked?
I think it would make sense to double-check the behavior of references and add a functional test for how we want it to behave. The case of having a single data view referenced multiple times in a dashboard is a very common one.
I also have some general questions, maybe this is planned to be done in follow-ups:
- The generated dashboards are not tagged/named that they come from a content pack - when installing the same one to multiple streams, this is quickly getting messy. Are we planning to do this?
- Updating a content pack can't remove assets from a stream - is this something that would make sense? Integrations have this ability, it seems to make sense here as well
- Should we somehow track whether the content pack assets are modified? That would be good to know when updating a content pack, otherwise local changes can be overwritten
|
Thanks for the review @flash1293
Yes only dashboard and index-pattern are currently supported but all the code necessary to support lens exists, it just needs to be enabled. I'll include that change
Good catch, we should not create links for references that are not included in the content pack (fixed in 3974efe)
The import logic will by default duplicate any object referenced by the dashboard that is also included in the content pack as long as it is a supported type. This is because we assume there is a pattern replacement being done on the object so it has to be duplicated. We can improve the logic and duplicate only if there is a replacement on the object, but this raises questions:
wdyt ?
Absolutely, good catch (fixed in 218b23d)
Yes tagging/adding metadata for content pack objects is planned, there's no issue tracking this yet but I'll create one
Agreed, we should leave a clean state corresponding to the latest version of the content pack imported. I'll create an issue for that
Definitely. I've left out the version out of this initial change, but the content pack links should carry the version of the object that was installed so we can make smarter decisions when updating |
|
Thanks for your answers, @klacabane In general this all makes sense to me, I think there are a couple downstream tasks we will need to do, but that's fine, they will become apparent once we built out these features. Especially the question with duplicating vs. reusing saved objects is important I think - maybe we can leverage the content pack tracking information also in the dashboarding listing UI and collapse the same dashboards linked with different streams? Just an idea, I think that can come later. I'm approving, but I would love to have another review from @tommyers-elastic on this |
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
History
|
|
Starting backport for target branches: 8.19 https://github.com/elastic/kibana/actions/runs/14901975111 |
## Summary When importing a content pack into a stream, we now store an object to audit this import. In addition to the content pack metadata that can now be surfaced, we also store metadata of the saved objects imported to remember the source object it was copied from. This allows updates of existing objects instead of creating a duplicate. The stored metadata is restricted to the stream/content pack name on purpose as it's not clear yet how versioning will be handled for content pack and dashboards. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit cc26c64)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
#220471) # Backport This will backport the following commits from `main` to `8.19`: - [[streams][content pack] track installed content packs (#218785)](#218785) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Kevin Lacabane","email":"kevin.lacabane@elastic.co"},"sourceCommit":{"committedDate":"2025-05-08T08:19:43Z","message":"[streams][content pack] track installed content packs (#218785)\n\n## Summary\n\nWhen importing a content pack into a stream, we now store an object to\naudit this import.\n\nIn addition to the content pack metadata that can now be surfaced, we\nalso store metadata of the saved objects imported to remember the source\nobject it was copied from. This allows updates of existing objects\ninstead of creating a duplicate.\nThe stored metadata is restricted to the stream/content pack name on\npurpose as it's not clear yet how versioning will be handled for content\npack and dashboards.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"cc26c649e589806ec0cc2c4b110694d4731ab005","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:obs-entities","backport:version","Feature:Streams","v9.1.0","v8.19.0"],"title":"[streams][content pack] track installed content packs","number":218785,"url":"https://github.com/elastic/kibana/pull/218785","mergeCommit":{"message":"[streams][content pack] track installed content packs (#218785)\n\n## Summary\n\nWhen importing a content pack into a stream, we now store an object to\naudit this import.\n\nIn addition to the content pack metadata that can now be surfaced, we\nalso store metadata of the saved objects imported to remember the source\nobject it was copied from. This allows updates of existing objects\ninstead of creating a duplicate.\nThe stored metadata is restricted to the stream/content pack name on\npurpose as it's not clear yet how versioning will be handled for content\npack and dashboards.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"cc26c649e589806ec0cc2c4b110694d4731ab005"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218785","number":218785,"mergeCommit":{"message":"[streams][content pack] track installed content packs (#218785)\n\n## Summary\n\nWhen importing a content pack into a stream, we now store an object to\naudit this import.\n\nIn addition to the content pack metadata that can now be surfaced, we\nalso store metadata of the saved objects imported to remember the source\nobject it was copied from. This allows updates of existing objects\ninstead of creating a duplicate.\nThe stored metadata is restricted to the stream/content pack name on\npurpose as it's not clear yet how versioning will be handled for content\npack and dashboards.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"cc26c649e589806ec0cc2c4b110694d4731ab005"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Kevin Lacabane <kevin.lacabane@elastic.co>
## Summary When importing a content pack into a stream, we now store an object to audit this import. In addition to the content pack metadata that can now be surfaced, we also store metadata of the saved objects imported to remember the source object it was copied from. This allows updates of existing objects instead of creating a duplicate. The stored metadata is restricted to the stream/content pack name on purpose as it's not clear yet how versioning will be handled for content pack and dashboards. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
## Summary When importing a content pack into a stream, we now store an object to audit this import. In addition to the content pack metadata that can now be surfaced, we also store metadata of the saved objects imported to remember the source object it was copied from. This allows updates of existing objects instead of creating a duplicate. The stored metadata is restricted to the stream/content pack name on purpose as it's not clear yet how versioning will be handled for content pack and dashboards. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Summary
When importing a content pack into a stream, we now store an object to audit this import.
In addition to the content pack metadata that can now be surfaced, we also store metadata of the saved objects imported to remember the source object it was copied from. This allows updates of existing objects instead of creating a duplicate.
The stored metadata is restricted to the stream/content pack name on purpose as it's not clear yet how versioning will be handled for content pack and dashboards.