Skip to content

Commit b829120

Browse files
[8.x] [SecuritySolution] Entity Engine status tab (#201235) (#202650)
# Backport This will backport the following commits from `main` to `8.x`: - [[SecuritySolution] Entity Engine status tab (#201235)](#201235) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Pablo Machado","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-29T15:29:04Z","message":"[SecuritySolution] Entity Engine status tab (#201235)\n\n## Summary\r\n\r\n* Add two tabs to the Entity Store page\r\n * The import entities tab has all the bulk upload content\r\n * The status tab has the new content created on this PR\r\n* Move the \"clear entity store data\" button to the header according to\r\ndesign mockups.\r\n* Delete unused stats route\r\n* Rename `enablement` API docs to `enable`\r\n* Add a new parameter to the status API (`withComponents`)\r\n * Should I make it snake cased?\r\n\r\n### import entities tab\r\n![Screenshot 2024-11-27 at 15 07\r\n01](https://github.com/user-attachments/assets/c433e217-781e-4792-8695-2ee609efa654)\r\n\r\n\r\n### status tab\r\n![Screenshot 2024-11-27 at 15 07\r\n20](https://github.com/user-attachments/assets/8970c023-22b3-4e83-a444-fa3ccf78ea42)\r\n\r\n\r\n## How to test it\r\n- Open security solution app with data\r\n- Go to entity store page\r\n- You shouldn't see the new tab because the engine is disabled\r\n- Enable the engine and wait\r\n- Click on the new tab that showed up\r\n- It should list user and host engine components, and everything should\r\nbe installed\r\n- Delete or misconfigure some of the resources, the new status should be\r\nreflected on the tab.\r\n\r\n\r\n## TODO:\r\n- [x] Rebase main after #199762 is\r\nmerged\r\n - [x] Remove temporary status hook\r\n- [x] Fix the\"clear entity data\" button. It should re-fetch the status\r\nAPI.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n### Checklist\r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"06b7993bd90cf84f87a99668c4425fb4dd6d6b5e","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["v9.0.0","Team: SecuritySolution","release_note:feature","Theme: entity_analytics","Feature:Entity Analytics","Team:Entity Analytics","backport:version","v8.18.0"],"number":201235,"url":"https://github.com/elastic/kibana/pull/201235","mergeCommit":{"message":"[SecuritySolution] Entity Engine status tab (#201235)\n\n## Summary\r\n\r\n* Add two tabs to the Entity Store page\r\n * The import entities tab has all the bulk upload content\r\n * The status tab has the new content created on this PR\r\n* Move the \"clear entity store data\" button to the header according to\r\ndesign mockups.\r\n* Delete unused stats route\r\n* Rename `enablement` API docs to `enable`\r\n* Add a new parameter to the status API (`withComponents`)\r\n * Should I make it snake cased?\r\n\r\n### import entities tab\r\n![Screenshot 2024-11-27 at 15 07\r\n01](https://github.com/user-attachments/assets/c433e217-781e-4792-8695-2ee609efa654)\r\n\r\n\r\n### status tab\r\n![Screenshot 2024-11-27 at 15 07\r\n20](https://github.com/user-attachments/assets/8970c023-22b3-4e83-a444-fa3ccf78ea42)\r\n\r\n\r\n## How to test it\r\n- Open security solution app with data\r\n- Go to entity store page\r\n- You shouldn't see the new tab because the engine is disabled\r\n- Enable the engine and wait\r\n- Click on the new tab that showed up\r\n- It should list user and host engine components, and everything should\r\nbe installed\r\n- Delete or misconfigure some of the resources, the new status should be\r\nreflected on the tab.\r\n\r\n\r\n## TODO:\r\n- [x] Rebase main after #199762 is\r\nmerged\r\n - [x] Remove temporary status hook\r\n- [x] Fix the\"clear entity data\" button. It should re-fetch the status\r\nAPI.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n### Checklist\r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"06b7993bd90cf84f87a99668c4425fb4dd6d6b5e"}},"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/201235","number":201235,"mergeCommit":{"message":"[SecuritySolution] Entity Engine status tab (#201235)\n\n## Summary\r\n\r\n* Add two tabs to the Entity Store page\r\n * The import entities tab has all the bulk upload content\r\n * The status tab has the new content created on this PR\r\n* Move the \"clear entity store data\" button to the header according to\r\ndesign mockups.\r\n* Delete unused stats route\r\n* Rename `enablement` API docs to `enable`\r\n* Add a new parameter to the status API (`withComponents`)\r\n * Should I make it snake cased?\r\n\r\n### import entities tab\r\n![Screenshot 2024-11-27 at 15 07\r\n01](https://github.com/user-attachments/assets/c433e217-781e-4792-8695-2ee609efa654)\r\n\r\n\r\n### status tab\r\n![Screenshot 2024-11-27 at 15 07\r\n20](https://github.com/user-attachments/assets/8970c023-22b3-4e83-a444-fa3ccf78ea42)\r\n\r\n\r\n## How to test it\r\n- Open security solution app with data\r\n- Go to entity store page\r\n- You shouldn't see the new tab because the engine is disabled\r\n- Enable the engine and wait\r\n- Click on the new tab that showed up\r\n- It should list user and host engine components, and everything should\r\nbe installed\r\n- Delete or misconfigure some of the resources, the new status should be\r\nreflected on the tab.\r\n\r\n\r\n## TODO:\r\n- [x] Rebase main after #199762 is\r\nmerged\r\n - [x] Remove temporary status hook\r\n- [x] Fix the\"clear entity data\" button. It should re-fetch the status\r\nAPI.\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n### Checklist\r\n\r\nReviewers should verify this PR satisfies this list as well.\r\n\r\n- [x] Any text added follows [EUI's writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing), uses\r\nsentence case text and includes [i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios\r\n- [x] The PR description includes the appropriate Release Notes section,\r\nand the correct `release_note:*` label is applied per the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <[email protected]>","sha":"06b7993bd90cf84f87a99668c4425fb4dd6d6b5e"}},{"branch":"8.x","label":"v8.18.0","labelRegex":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> --------- Co-authored-by: kibanamachine <[email protected]>
1 parent 02c7cc7 commit b829120

File tree

38 files changed

+1605
-479
lines changed

38 files changed

+1605
-479
lines changed

oas_docs/output/kibana.yaml

Lines changed: 58 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11011,41 +11011,6 @@ paths:
1101111011
summary: Start an Entity Engine
1101211012
tags:
1101311013
- Security Entity Analytics API
11014-
/api/entity_store/engines/{entityType}/stats:
11015-
post:
11016-
operationId: GetEntityEngineStats
11017-
parameters:
11018-
- description: The entity type of the engine (either 'user' or 'host').
11019-
in: path
11020-
name: entityType
11021-
required: true
11022-
schema:
11023-
$ref: '#/components/schemas/Security_Entity_Analytics_API_EntityType'
11024-
responses:
11025-
'200':
11026-
content:
11027-
application/json; Elastic-Api-Version=2023-10-31:
11028-
schema:
11029-
type: object
11030-
properties:
11031-
indexPattern:
11032-
$ref: '#/components/schemas/Security_Entity_Analytics_API_IndexPattern'
11033-
indices:
11034-
items:
11035-
type: object
11036-
type: array
11037-
status:
11038-
$ref: '#/components/schemas/Security_Entity_Analytics_API_EngineStatus'
11039-
transforms:
11040-
items:
11041-
type: object
11042-
type: array
11043-
type:
11044-
$ref: '#/components/schemas/Security_Entity_Analytics_API_EntityType'
11045-
description: Successful response
11046-
summary: Get Entity Engine stats
11047-
tags:
11048-
- Security Entity Analytics API
1104911014
/api/entity_store/engines/{entityType}/stop:
1105011015
post:
1105111016
operationId: StopEntityEngine
@@ -11196,6 +11161,12 @@ paths:
1119611161
/api/entity_store/status:
1119711162
get:
1119811163
operationId: GetEntityStoreStatus
11164+
parameters:
11165+
- description: If true returns a detailed status of the engine including all it's components
11166+
in: query
11167+
name: include_components
11168+
schema:
11169+
type: boolean
1119911170
responses:
1120011171
'200':
1120111172
content:
@@ -11205,10 +11176,20 @@ paths:
1120511176
properties:
1120611177
engines:
1120711178
items:
11208-
$ref: '#/components/schemas/Security_Entity_Analytics_API_EngineDescriptor'
11179+
allOf:
11180+
- $ref: '#/components/schemas/Security_Entity_Analytics_API_EngineDescriptor'
11181+
- type: object
11182+
properties:
11183+
components:
11184+
items:
11185+
$ref: '#/components/schemas/Security_Entity_Analytics_API_EngineComponentStatus'
11186+
type: array
1120911187
type: array
1121011188
status:
1121111189
$ref: '#/components/schemas/Security_Entity_Analytics_API_StoreStatus'
11190+
required:
11191+
- status
11192+
- engines
1121211193
description: Successful response
1121311194
summary: Get the status of the Entity Store
1121411195
tags:
@@ -38949,6 +38930,47 @@ components:
3894938930
$ref: '#/components/schemas/Security_Entity_Analytics_API_AssetCriticalityLevel'
3895038931
required:
3895138932
- criticality_level
38933+
Security_Entity_Analytics_API_EngineComponentResource:
38934+
enum:
38935+
- entity_engine
38936+
- entity_definition
38937+
- index
38938+
- component_template
38939+
- index_template
38940+
- ingest_pipeline
38941+
- enrich_policy
38942+
- task
38943+
- transform
38944+
type: string
38945+
Security_Entity_Analytics_API_EngineComponentStatus:
38946+
type: object
38947+
properties:
38948+
errors:
38949+
items:
38950+
type: object
38951+
properties:
38952+
message:
38953+
type: string
38954+
title:
38955+
type: string
38956+
type: array
38957+
health:
38958+
enum:
38959+
- green
38960+
- yellow
38961+
- red
38962+
- unknown
38963+
type: string
38964+
id:
38965+
type: string
38966+
installed:
38967+
type: boolean
38968+
resource:
38969+
$ref: '#/components/schemas/Security_Entity_Analytics_API_EngineComponentResource'
38970+
required:
38971+
- id
38972+
- installed
38973+
- resource
3895238974
Security_Entity_Analytics_API_EngineDataviewUpdateResult:
3895338975
type: object
3895438976
properties:

x-pack/plugins/security_solution/common/api/entity_analytics/entity_store/common.gen.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,37 @@ export const EngineDescriptor = z.object({
3939
error: z.object({}).optional(),
4040
});
4141

42+
export type EngineComponentResource = z.infer<typeof EngineComponentResource>;
43+
export const EngineComponentResource = z.enum([
44+
'entity_engine',
45+
'entity_definition',
46+
'index',
47+
'component_template',
48+
'index_template',
49+
'ingest_pipeline',
50+
'enrich_policy',
51+
'task',
52+
'transform',
53+
]);
54+
export type EngineComponentResourceEnum = typeof EngineComponentResource.enum;
55+
export const EngineComponentResourceEnum = EngineComponentResource.enum;
56+
57+
export type EngineComponentStatus = z.infer<typeof EngineComponentStatus>;
58+
export const EngineComponentStatus = z.object({
59+
id: z.string(),
60+
installed: z.boolean(),
61+
resource: EngineComponentResource,
62+
health: z.enum(['green', 'yellow', 'red', 'unknown']).optional(),
63+
errors: z
64+
.array(
65+
z.object({
66+
title: z.string().optional(),
67+
message: z.string().optional(),
68+
})
69+
)
70+
.optional(),
71+
});
72+
4273
export type StoreStatus = z.infer<typeof StoreStatus>;
4374
export const StoreStatus = z.enum(['not_installed', 'installing', 'running', 'stopped', 'error']);
4475
export type StoreStatusEnum = typeof StoreStatus.enum;

x-pack/plugins/security_solution/common/api/entity_analytics/entity_store/common.schema.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,49 @@ components:
4242
- updating
4343
- error
4444

45+
EngineComponentStatus:
46+
type: object
47+
required:
48+
- id
49+
- installed
50+
- resource
51+
properties:
52+
id:
53+
type: string
54+
installed:
55+
type: boolean
56+
resource:
57+
$ref: '#/components/schemas/EngineComponentResource'
58+
health:
59+
type: string
60+
enum:
61+
- green
62+
- yellow
63+
- red
64+
- unknown
65+
errors:
66+
type: array
67+
items:
68+
type: object
69+
properties:
70+
title:
71+
type: string
72+
message:
73+
type: string
74+
75+
EngineComponentResource:
76+
type: string
77+
enum:
78+
- entity_engine
79+
- entity_definition
80+
- index
81+
- component_template
82+
- index_template
83+
- ingest_pipeline
84+
- enrich_policy
85+
- task
86+
- transform
87+
4588
StoreStatus:
4689
type: string
4790
enum:

x-pack/plugins/security_solution/common/api/entity_analytics/entity_store/enablement.gen.ts renamed to x-pack/plugins/security_solution/common/api/entity_analytics/entity_store/enable.gen.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@
1616

1717
import { z } from '@kbn/zod';
1818

19-
import { IndexPattern, EngineDescriptor, StoreStatus } from './common.gen';
20-
21-
export type GetEntityStoreStatusResponse = z.infer<typeof GetEntityStoreStatusResponse>;
22-
export const GetEntityStoreStatusResponse = z.object({
23-
status: StoreStatus.optional(),
24-
engines: z.array(EngineDescriptor).optional(),
25-
});
19+
import { IndexPattern, EngineDescriptor } from './common.gen';
2620

2721
export type InitEntityStoreRequestBody = z.infer<typeof InitEntityStoreRequestBody>;
2822
export const InitEntityStoreRequestBody = z.object({
Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,3 @@ paths:
4141
type: array
4242
items:
4343
$ref: './common.schema.yaml#/components/schemas/EngineDescriptor'
44-
45-
/api/entity_store/status:
46-
get:
47-
x-labels: [ess, serverless]
48-
x-codegen-enabled: true
49-
operationId: GetEntityStoreStatus
50-
summary: Get the status of the Entity Store
51-
responses:
52-
'200':
53-
description: Successful response
54-
content:
55-
application/json:
56-
schema:
57-
type: object
58-
properties:
59-
status:
60-
$ref: './common.schema.yaml#/components/schemas/StoreStatus'
61-
engines:
62-
type: array
63-
items:
64-
$ref: './common.schema.yaml#/components/schemas/EngineDescriptor'

x-pack/plugins/security_solution/common/api/entity_analytics/entity_store/engine/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ export * from './get.gen';
1010
export * from './init.gen';
1111
export * from './list.gen';
1212
export * from './start.gen';
13-
export * from './stats.gen';
1413
export * from './stop.gen';
1514
export * from './apply_dataview_indices.gen';

x-pack/plugins/security_solution/common/api/entity_analytics/entity_store/engine/stats.gen.ts

Lines changed: 0 additions & 39 deletions
This file was deleted.

x-pack/plugins/security_solution/common/api/entity_analytics/entity_store/engine/stats.schema.yaml

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
/*
9+
* NOTICE: Do not edit this file manually.
10+
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator.
11+
*
12+
* info:
13+
* title: Enable Entity Store
14+
* version: 2023-10-31
15+
*/
16+
17+
import { z } from '@kbn/zod';
18+
import { BooleanFromString } from '@kbn/zod-helpers';
19+
20+
import { StoreStatus, EngineDescriptor, EngineComponentStatus } from './common.gen';
21+
22+
export type GetEntityStoreStatusRequestQuery = z.infer<typeof GetEntityStoreStatusRequestQuery>;
23+
export const GetEntityStoreStatusRequestQuery = z.object({
24+
/**
25+
* If true returns a detailed status of the engine including all it's components
26+
*/
27+
include_components: BooleanFromString.optional(),
28+
});
29+
export type GetEntityStoreStatusRequestQueryInput = z.input<
30+
typeof GetEntityStoreStatusRequestQuery
31+
>;
32+
33+
export type GetEntityStoreStatusResponse = z.infer<typeof GetEntityStoreStatusResponse>;
34+
export const GetEntityStoreStatusResponse = z.object({
35+
status: StoreStatus,
36+
engines: z.array(
37+
EngineDescriptor.merge(
38+
z.object({
39+
components: z.array(EngineComponentStatus).optional(),
40+
})
41+
)
42+
),
43+
});

0 commit comments

Comments
 (0)