Skip to content

[Entity Analytics] [Entity Store] Refactor entity store enablement (server side)#199638

Merged
tiansivive merged 14 commits intoelastic:mainfrom
tiansivive:ea-store-enablement-refactor
Nov 19, 2024
Merged

[Entity Analytics] [Entity Store] Refactor entity store enablement (server side)#199638
tiansivive merged 14 commits intoelastic:mainfrom
tiansivive:ea-store-enablement-refactor

Conversation

@tiansivive
Copy link
Copy Markdown
Contributor

@tiansivive tiansivive commented Nov 11, 2024

Summary

This PR adds 2 new endpoints regarding enablement of the Entity Store:

  • api/entity_store/enable, which initializes entity engines for both user and host entities
  • api/entity_store/status, which computes a global store status based on the individual engine status

In addition, running initialization of multiple engines in parallel is now allowed.

How to test

  1. Use dev tools to call POST kbn:/api/entity_store/enable
  2. Check that two engines were created and that the status is installing by calling GET kbn:/api/entity_store/status
  3. Wait a few seconds and keep calling the status endpoint. Once initialization finishes, the status should switch to running

@tiansivive tiansivive added technical debt Improvement of the software architecture and operational architecture release_note:skip Skip the PR/issue when compiling release notes v9.0.0 Team:Entity Analytics Security Entity Analytics Team backport:version Backport to applied version labels v8.17.0 labels Nov 11, 2024
return { engines, succeeded: true };
}

public async status(): Promise<GetEntityStoreStatusResponse> {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is this the correct way to compute the status?
What should we do in those "in between" states, where, for example, not all engines are stopped?

Maybe worry about it later if we ever decide allowing individual engine setup?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What should we do in those "in between" states, where, for example, not all engines are stopped?

is the current response "running"? I think thats fine

@tiansivive tiansivive marked this pull request as ready for review November 12, 2024 10:32
@tiansivive tiansivive requested review from a team as code owners November 12, 2024 10:32
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-entity-analytics (Team:Entity Analytics)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this should be handled inside createRiskScoreLatestIndex what do you think?

Copy link
Copy Markdown
Contributor Author

@tiansivive tiansivive Nov 18, 2024

Choose a reason for hiding this comment

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

Not sure...

I thought about it for a while, and it does fit with our overall approach but I'm worried it might be too strict of an abstraction. For example, if we ever get some feature where it is important to handle these errors (maybe we want to show something in the UI) we would be stuck 🤔

In general I think it's probably best to leave each client/consumer handle the errors. Since this is such a common way for us to handle this particular error, maybe we can have some utility fn to reduce the boilerplate?

@hop-dev
Copy link
Copy Markdown
Contributor

hop-dev commented Nov 14, 2024

Tested locally, working great 🚀 we just need to add an integration test for the status endpoint

@tiansivive tiansivive force-pushed the ea-store-enablement-refactor branch from 10d402c to b8dae7a Compare November 18, 2024 11:52
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #107 / Entity Analytics - Entity Store @ess @skipInServerlessMKI Entity Store APIs apply_dataview_indices "before all" hook for "should not update the index patten when it didn't change"

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 13.4MB 13.4MB +77.0B

History

@kibanamachine
Copy link
Copy Markdown
Contributor

Flaky Test Runner Stats

🟠 Some tests failed. - kibana-flaky-test-suite-runner#7420

[❌] x-pack/test/security_solution_api_integration/test_suites/entity_analytics/entity_store/trial_license_complete_tier/configs/ess.config.ts: 60/100 tests passed.

see run history

@tiansivive tiansivive merged commit 3757e64 into elastic:main Nov 19, 2024
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.x

https://github.com/elastic/kibana/actions/runs/11913775121

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 199638

Questions ?

Please refer to the Backport tool documentation

@tiansivive
Copy link
Copy Markdown
Contributor Author

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

tiansivive added a commit to tiansivive/kibana that referenced this pull request Nov 20, 2024
…erver side) (elastic#199638)

## Summary

This PR adds 2 new endpoints regarding enablement of the Entity Store:
* `api/entity_store/enable`, which initializes entity engines for both
`user` and `host` entities
* `api/entity_store/status`, which computes a global store status based
on the individual engine status

In addition, running initialization of multiple engines in parallel is
now allowed.

### How to test

1. Use dev tools to call `POST kbn:/api/entity_store/enable`
2. Check that two engines were created and that the status is
`installing` by calling `GET kbn:/api/entity_store/status`
3. Wait a few seconds and keep calling the `status` endpoint. Once
initialization finishes, the status should switch to `running`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 3757e64)

# Conflicts:
#	oas_docs/output/kibana.serverless.yaml
#	oas_docs/output/kibana.yaml
@tiansivive
Copy link
Copy Markdown
Contributor Author

💚 All backports created successfully

Status Branch Result
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

tiansivive added a commit to tiansivive/kibana that referenced this pull request Nov 20, 2024
…erver side) (elastic#199638)

## Summary

This PR adds 2 new endpoints regarding enablement of the Entity Store:
* `api/entity_store/enable`, which initializes entity engines for both
`user` and `host` entities
* `api/entity_store/status`, which computes a global store status based
on the individual engine status

In addition, running initialization of multiple engines in parallel is
now allowed.

### How to test

1. Use dev tools to call `POST kbn:/api/entity_store/enable`
2. Check that two engines were created and that the status is
`installing` by calling `GET kbn:/api/entity_store/status`
3. Wait a few seconds and keep calling the `status` endpoint. Once
initialization finishes, the status should switch to `running`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 3757e64)

# Conflicts:
#	oas_docs/output/kibana.serverless.yaml
#	oas_docs/output/kibana.yaml
@CAWilson94 CAWilson94 assigned CAWilson94 and unassigned CAWilson94 Nov 20, 2024
tiansivive added a commit that referenced this pull request Nov 21, 2024
…ent (server side) (#199638) (#200875)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Entity Analytics] [Entity Store] Refactor entity store enablement
(server side) (#199638)](#199638)

<!--- Backport version: 8.9.8 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Tiago Vila
Verde","email":"tiago.vilaverde@elastic.co"},"sourceCommit":{"committedDate":"2024-11-19T13:11:24Z","message":"[Entity
Analytics] [Entity Store] Refactor entity store enablement (server side)
(#199638)\n\n## Summary\r\n\r\nThis PR adds 2 new endpoints regarding
enablement of the Entity Store:\r\n* `api/entity_store/enable`, which
initializes entity engines for both\r\n`user` and `host` entities\r\n*
`api/entity_store/status`, which computes a global store status
based\r\non the individual engine status\r\n\r\nIn addition, running
initialization of multiple engines in parallel is\r\nnow
allowed.\r\n\r\n\r\n### How to test\r\n\r\n1. Use dev tools to call
`POST kbn:/api/entity_store/enable`\r\n2. Check that two engines were
created and that the status is\r\n`installing` by calling `GET
kbn:/api/entity_store/status`\r\n3. Wait a few seconds and keep calling
the `status` endpoint. Once\r\ninitialization finishes, the status
should switch to `running`\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"3757e641278a5186919e35a0f980ac3cda7e8ccd","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["technical
debt","release_note:skip","v9.0.0","Team:Entity
Analytics","backport:version","v8.17.0"],"number":199638,"url":"https://github.com/elastic/kibana/pull/199638","mergeCommit":{"message":"[Entity
Analytics] [Entity Store] Refactor entity store enablement (server side)
(#199638)\n\n## Summary\r\n\r\nThis PR adds 2 new endpoints regarding
enablement of the Entity Store:\r\n* `api/entity_store/enable`, which
initializes entity engines for both\r\n`user` and `host` entities\r\n*
`api/entity_store/status`, which computes a global store status
based\r\non the individual engine status\r\n\r\nIn addition, running
initialization of multiple engines in parallel is\r\nnow
allowed.\r\n\r\n\r\n### How to test\r\n\r\n1. Use dev tools to call
`POST kbn:/api/entity_store/enable`\r\n2. Check that two engines were
created and that the status is\r\n`installing` by calling `GET
kbn:/api/entity_store/status`\r\n3. Wait a few seconds and keep calling
the `status` endpoint. Once\r\ninitialization finishes, the status
should switch to `running`\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"3757e641278a5186919e35a0f980ac3cda7e8ccd"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199638","number":199638,"mergeCommit":{"message":"[Entity
Analytics] [Entity Store] Refactor entity store enablement (server side)
(#199638)\n\n## Summary\r\n\r\nThis PR adds 2 new endpoints regarding
enablement of the Entity Store:\r\n* `api/entity_store/enable`, which
initializes entity engines for both\r\n`user` and `host` entities\r\n*
`api/entity_store/status`, which computes a global store status
based\r\non the individual engine status\r\n\r\nIn addition, running
initialization of multiple engines in parallel is\r\nnow
allowed.\r\n\r\n\r\n### How to test\r\n\r\n1. Use dev tools to call
`POST kbn:/api/entity_store/enable`\r\n2. Check that two engines were
created and that the status is\r\n`installing` by calling `GET
kbn:/api/entity_store/status`\r\n3. Wait a few seconds and keep calling
the `status` endpoint. Once\r\ninitialization finishes, the status
should switch to `running`\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"3757e641278a5186919e35a0f980ac3cda7e8ccd"}},{"branch":"8.x","label":"v8.17.0","labelRegex":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
paulinashakirova pushed a commit to paulinashakirova/kibana that referenced this pull request Nov 26, 2024
…erver side) (elastic#199638)

## Summary

This PR adds 2 new endpoints regarding enablement of the Entity Store:
* `api/entity_store/enable`, which initializes entity engines for both
`user` and `host` entities
* `api/entity_store/status`, which computes a global store status based
on the individual engine status

In addition, running initialization of multiple engines in parallel is
now allowed.


### How to test

1. Use dev tools to call `POST kbn:/api/entity_store/enable`
2. Check that two engines were created and that the status is
`installing` by calling `GET kbn:/api/entity_store/status`
3. Wait a few seconds and keep calling the `status` endpoint. Once
initialization finishes, the status should switch to `running`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Dec 12, 2024
…erver side) (elastic#199638)

## Summary

This PR adds 2 new endpoints regarding enablement of the Entity Store:
* `api/entity_store/enable`, which initializes entity engines for both
`user` and `host` entities
* `api/entity_store/status`, which computes a global store status based
on the individual engine status

In addition, running initialization of multiple engines in parallel is
now allowed.


### How to test

1. Use dev tools to call `POST kbn:/api/entity_store/enable`
2. Check that two engines were created and that the status is
`installing` by calling `GET kbn:/api/entity_store/status`
3. Wait a few seconds and keep calling the `status` endpoint. Once
initialization finishes, the status should switch to `running`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:skip Skip the PR/issue when compiling release notes Team:Entity Analytics Security Entity Analytics Team technical debt Improvement of the software architecture and operational architecture v8.17.0 v8.18.0 v9.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants