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

[Entities] Add spaceId to entities #183943

Merged
merged 8 commits into from
May 31, 2024

Conversation

simianhacker
Copy link
Member

Summary

This PR closes https://github.com/elastic/observed-asset-model/issues/67 by capturing the spaceId from the API request and storing the entity.spaceId via the ingest pipeline.

@simianhacker simianhacker requested review from a team as code owners May 21, 2024 16:45
@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label May 21, 2024
@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@simianhacker simianhacker added release_note:enhancement v8.15.0 Team:obs-knowledge Observability Experience Knowledge team labels May 21, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-knowledge-team (Team:obs-knowledge)

Copy link
Member

@afharo afharo left a comment

Choose a reason for hiding this comment

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

One small gotcha 😇

Copy link

@tommyers-elastic tommyers-elastic left a comment

Choose a reason for hiding this comment

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

i wonder if the definition itself is scoped to the space, or if (as here) the definition is space-agnostic, and the definition is installed into a space? i think the former makes more sense, based on how we think the space-scoped config might apply to the definition (different index patterns etc).

if this is the case, we would need to store the space id with the definition too; this would come with some baggage, since our internal entity definition schema would no longer match our API entity definition schema (since the space id is typically a request param, as here).

what do you think? i'm probably over-thinking it, but i feel like maybe either way we should store the space id in the definition saved object too.

@simianhacker
Copy link
Member Author

i wonder if the definition itself is scoped to the space, or if (as here) the definition is space-agnostic, and the definition is installed into a space? i think the former makes more sense, based on how we think the space-scoped config might apply to the definition (different index patterns etc).

The definition is installed into the default space for the SavedObjects if you don't specify /s/{spaceId} in the URL request; the SavedObjects client is already space aware, regardless of this PR. If/when we allow users to create definitions via a UI we will need to support spaces so we might as well make this work from the start. This ensures we can query the data and only return results that are appropriate for the space. This will become more important when we expose the POST /api/entities/_find endpoint because we should also include { "match": { "entity.spaceId": {spaceId} } } as a default query filter.

if this is the case, we would need to store the space id with the definition too; this would come with some baggage, since our internal entity definition schema would no longer match our API entity definition schema (since the space id is typically a request param, as here).

I don't think we need to store this in the entity definition. We should keep the definition space agnostic and the only time it's associated with a space is if you create the definition using POST /s/{spaceId}/api/entities/definition. For the OTB definitions, it will depend on which space the user was in when they installed the "EEM Integration" (which doesn't exist yet but we need to keep that in mind).

@simianhacker simianhacker requested a review from afharo May 22, 2024 22:35
@tommyers-elastic
Copy link

got it - so the space the definition was installed into is part of the saved object itself, not the definition.

i guess it means you could install the same definition into multiple spaces at once. should we include the space ID in the output index names too, to avoid this scenario causing duplicate entities in the same index?

@simianhacker
Copy link
Member Author

simianhacker commented May 23, 2024

I'll add the space id to the indices in this PR.

After discussing with @tommyers-elastic offline, we'll add the spaceId to the index name after this is merge due to the changes in the historical PR I'm currently working on.

@simianhacker
Copy link
Member Author

@elasticmachine merge upstream

@simianhacker
Copy link
Member Author

@elasticmachine merge upstream

@kibana-ci
Copy link
Collaborator

kibana-ci commented May 30, 2024

💚 Build Succeeded

Metrics [docs]

Canvas Sharable Runtime

The Canvas "shareable runtime" is an bundle produced to enable running Canvas workpads outside of Kibana. This bundle is included in third-party webpages that embed canvas and therefor should be as slim as possible.

id before after diff
module count - 5414 +5414
total size - 8.8MB +8.8MB

History

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

@simianhacker simianhacker merged commit cc317a0 into elastic:main May 31, 2024
21 checks passed
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting ci:project-deploy-observability Create an Observability project release_note:enhancement Team:obs-knowledge Observability Experience Knowledge team v8.15.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants