-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Inventory] Inventory k8s entities fixes (#201260)
closes [#201226](#201226) ## Summary This PR makes the final adjustments on k8s entities after the #196916 was merged. I had to fix most of the ECS entities because they had their `entityId` defined with `uid` field. Most of the ECS K8s entities don't have this field and should use the `name` field instead (see [metricsets](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-kubernetes.html#_metricsets_41)) ~I also had to fix the transforms to include an aggregation for the `displayNameTemplate` field, when it doesn't match with the `entity.Id`~ ### Real data Otel The screenshots below are from a tests running the `opentemeletry-demo` sending otel data <img width="710" alt="image" src="https://github.com/user-attachments/assets/d223858d-3b99-4bb0-b69e-3b70112a2c17"> <img width="710" alt="image" src="https://github.com/user-attachments/assets/1ef27dcd-682c-4681-b92b-be9b4f2b32b8"> ### Real data ECS The screenshots below are from a tests running the `opentemeletry-demo` with elastic agent installed with Kubernetes integration <img width="710" alt="image" src="https://github.com/user-attachments/assets/e2fb6cbd-60a0-4995-bc94-8ccbc8911db1"> <img width="710" alt="image" src="https://github.com/user-attachments/assets/a3d9dba3-fee7-42af-972b-34a151b52f2b"> ### Additional test with synthtrace <img width="709" alt="image" src="https://github.com/user-attachments/assets/bf56da1e-0bbb-40a0-9f44-06b9f86427a8"> ### Fix ECS k8s service entity was missing the link to its corresponding dashboard <img width="709" alt="image" src="https://github.com/user-attachments/assets/488891a6-1c61-4001-b604-208478e1c798"> <img width="709" alt="image" src="https://github.com/user-attachments/assets/0b30c56b-db52-4d82-a7e7-100dae91a35e"> ### How to test - Start local kibana and es instances - run ` node scripts/synthtrace k8s_entities.ts --clean --live` - Navigate to Inventory and enable EEM --------- Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
3188cda
commit aead7b9
Showing
42 changed files
with
282 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
packages/kbn-apm-synthtrace-client/src/lib/entities/kubernetes/service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the "Elastic License | ||
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
* Public License v 1"; you may not use this file except in compliance with, at | ||
* your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
|
||
import { Schema } from '..'; | ||
import { K8sEntity } from '.'; | ||
|
||
export function k8sServiceEntity({ | ||
schema, | ||
name, | ||
uid, | ||
clusterName, | ||
entityId, | ||
...others | ||
}: { | ||
schema: Schema; | ||
name: string; | ||
uid?: string; | ||
clusterName?: string; | ||
entityId: string; | ||
[key: string]: any; | ||
}) { | ||
if (schema !== 'ecs') { | ||
throw new Error('Schema not supported for service entity: ' + schema); | ||
} | ||
return new K8sEntity(schema, { | ||
'entity.definition_id': 'service', | ||
'entity.type': 'service', | ||
'kubernetes.service.name': name, | ||
'kubernetes.namespace': clusterName, | ||
'entity.id': entityId, | ||
...others, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.