[Entity Analytics] [Entity Store] Refactor entity store enablement (server side)#199638
Conversation
| return { engines, succeeded: true }; | ||
| } | ||
|
|
||
| public async status(): Promise<GetEntityStoreStatusResponse> { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
|
Pinging @elastic/security-entity-analytics (Team:Entity Analytics) |
There was a problem hiding this comment.
I think this should be handled inside createRiskScoreLatestIndex what do you think?
There was a problem hiding this comment.
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?
|
Tested locally, working great 🚀 we just need to add an integration test for the status endpoint |
10d402c to
b8dae7a
Compare
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
History
|
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. |
|
Starting backport for target branches: 8.x |
💔 All backports failed
Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…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
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…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
…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>
…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>
…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>
Summary
This PR adds 2 new endpoints regarding enablement of the Entity Store:
api/entity_store/enable, which initializes entity engines for bothuserandhostentitiesapi/entity_store/status, which computes a global store status based on the individual engine statusIn addition, running initialization of multiple engines in parallel is now allowed.
How to test
POST kbn:/api/entity_store/enableinstallingby callingGET kbn:/api/entity_store/statusstatusendpoint. Once initialization finishes, the status should switch torunning