[EEM] Replace hashed ID with human readable ID#193652
[EEM] Replace hashed ID with human readable ID#193652miltonhultgren merged 3 commits intoelastic:mainfrom
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
|
/ci |
There was a problem hiding this comment.
can we sort the identityFields to make sure it is consistent even if the order of identityFields for whatever reason changes?
There was a problem hiding this comment.
the pr desc mentions this but looks like it's not implemented yet
There was a problem hiding this comment.
The one problem I see with this is that any consumer of the definition must then also remember to sort the fields first before recreating the ID.
While if we rely on the order of definition, it is up to the author to ensure the order makes sense as the set of fields changes.
Could it be that it's a valid case to change the order of the fields?
It should not have any semantic meaning, but may lead to "prettier" IDs being generated depending on the values found in the used fields.
In a world where we don't do materialization (by default), this seems like a smaller problem?
We did have some discussion recently where we said that essentially, if you change the identity fields, we should just throw away any previously materialized data as well.
There was a problem hiding this comment.
I think we can expose utility methods that convert the id into an entity, and given that, I would personally prefer sorting the identity fields because we can sort it always when we deserialize, instead of hoping no one changed the order of the identity fields (for whatever reason).
There was a problem hiding this comment.
In a world where interactions go through an entities client, that should be fine, I'll add the sorting then.
There was a problem hiding this comment.
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]Async chunks
History
To update your PR or re-run it, just comment with: |
8cc989a to
9c3997d
Compare
bf3fe56 to
9afd5ad
Compare
| .object({ | ||
| field: z.string(), | ||
| optional: z.boolean(), | ||
| optional: z.literal(false), |
There was a problem hiding this comment.
This blocks people from using optional fields even though technically this is still supported in the code, and we transform the existing saved objects to remove them.
This is mainly due to not being able to change the saved object mapping.
| EntityDefinition, | ||
| EntityDefinition | ||
| > = (savedObject) => { | ||
| // Doing only this may break displayNameTemplates |
There was a problem hiding this comment.
Which I think is okay since we're likely to remove this anyway in the future since it's hard to do any kind of template in ES|QL at runtime. So the displayNameTemplate might become similar to the identity field, where we just let users decide which fields to concat instead.
… src/core/server/integration_tests/ci_checks'
💚 Build Succeeded
Metrics [docs]Async chunks
History
|
jloleysens
left a comment
There was a problem hiding this comment.
Unsafe transform LGTM.
|
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11405848322 |
This PR turns the `entity.id` field format from a hashed value to a human readable string of the **values** found in the identity fields, such as `my_host-my_cloud_zone` for the identity fields `[host.name, cloud.availability_zone]`. The order of the values is based on the order in the identity fields list. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit ae2c6ad)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
# Backport This will backport the following commits from `main` to `8.x`: - [[EEM] Replace hashed ID with human readable ID (#193652)](#193652) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Milton Hultgren","email":"milton.hultgren@elastic.co"},"sourceCommit":{"committedDate":"2024-10-18T14:42:38Z","message":"[EEM] Replace hashed ID with human readable ID (#193652)\n\nThis PR turns the `entity.id` field format from a hashed value to a\r\nhuman readable string of the **values** found in the identity fields,\r\nsuch as `my_host-my_cloud_zone` for the identity fields `[host.name,\r\ncloud.availability_zone]`.\r\nThe order of the values is based on the order in the identity fields\r\nlist.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"ae2c6ad321f2b4318d4114c1309b4420861bcd29","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Feature:EEM"],"title":"[EEM] Replace hashed ID with human readable ID","number":193652,"url":"https://github.com/elastic/kibana/pull/193652","mergeCommit":{"message":"[EEM] Replace hashed ID with human readable ID (#193652)\n\nThis PR turns the `entity.id` field format from a hashed value to a\r\nhuman readable string of the **values** found in the identity fields,\r\nsuch as `my_host-my_cloud_zone` for the identity fields `[host.name,\r\ncloud.availability_zone]`.\r\nThe order of the values is based on the order in the identity fields\r\nlist.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"ae2c6ad321f2b4318d4114c1309b4420861bcd29"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193652","number":193652,"mergeCommit":{"message":"[EEM] Replace hashed ID with human readable ID (#193652)\n\nThis PR turns the `entity.id` field format from a hashed value to a\r\nhuman readable string of the **values** found in the identity fields,\r\nsuch as `my_host-my_cloud_zone` for the identity fields `[host.name,\r\ncloud.availability_zone]`.\r\nThe order of the values is based on the order in the identity fields\r\nlist.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"ae2c6ad321f2b4318d4114c1309b4420861bcd29"}}]}] BACKPORT--> Co-authored-by: Milton Hultgren <milton.hultgren@elastic.co>
This PR turns the `entity.id` field format from a hashed value to a human readable string of the **values** found in the identity fields, such as `my_host-my_cloud_zone` for the identity fields `[host.name, cloud.availability_zone]`. The order of the values is based on the order in the identity fields list. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> (cherry picked from commit ae2c6ad)
) # Backport This will backport the following commits from `main` to `8.16`: - [EEM] Replace hashed ID with human readable ID (#193652) (ae2c6ad) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Milton Hultgren","email":"milton.hultgren@elastic.co"},"sourceCommit":{"committedDate":"2024-10-18T14:42:38Z","message":"[EEM] Replace hashed ID with human readable ID (#193652)\n\nThis PR turns the `entity.id` field format from a hashed value to a\r\nhuman readable string of the **values** found in the identity fields,\r\nsuch as `my_host-my_cloud_zone` for the identity fields `[host.name,\r\ncloud.availability_zone]`.\r\nThe order of the values is based on the order in the identity fields\r\nlist.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"ae2c6ad321f2b4318d4114c1309b4420861bcd29"},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[]}] BACKPORT--> Co-authored-by: Milton Hultgren <milton.hultgren@elastic.co>
This PR turns the
entity.idfield format from a hashed value to a human readable string of the values found in the identity fields, such asmy_host-my_cloud_zonefor the identity fields[host.name, cloud.availability_zone].The order of the values is based on the order in the identity fields list.