forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Synthtrace] Adding Entities support (elastic#196258)
## known issue ``` - Transforms are not started by synthtrace. Because it duplicates data ingested by synthrace on signal indices. And it takes a long time to generate data. - We are not able to open the Inventory page because of 👆🏻. ``` --- ``` node scripts/synthtrace.js traces_logs_entities.ts --clean --live ``` or ``` node scripts/synthtrace.js traces_logs_entities.ts --clean --from=2024-04-08T08:00:00.000Z --to=2024-04-08T08:15:00.000Z ``` docs produces by the new scenario: ``` { "took": 1, "timed_out": false, "_shards": { "total": 1, "successful": 1, "skipped": 0, "failed": 0 }, "hits": { "total": { "value": 3, "relation": "eq" }, "max_score": 1, "hits": [ { "_index": ".entities.v1.latest.builtin_services_from_ecs_data", "_id": "2846700000000001", "_score": 1, "_source": { "service": { "name": "synth-node-trace-logs", "environment": "Synthtrace: traces_logs_entities" }, "source_data_stream": { "type": [ "traces", "logs" ] }, "agent": { "name": [ "nodejs" ] }, "entity": { "id": "2846700000000001", "type": "service", "definitionId": "latest", "lastSeenTimestamp": "2024-10-15T08:56:20.562Z" }, "event": { "ingested": "2024-10-15T08:56:20.562Z" } } }, { "_index": ".entities.v1.latest.builtin_services_from_ecs_data", "_id": "2846700000000000", "_score": 1, "_source": { "service": { "name": "synth-java-trace", "environment": "Synthtrace: traces_logs_entities" }, "source_data_stream": { "type": [ "traces" ] }, "agent": { "name": [ "java" ] }, "entity": { "id": "2846700000000000", "type": "service", "definitionId": "latest", "lastSeenTimestamp": "2024-10-15T08:56:20.562Z" }, "event": { "ingested": "2024-10-15T08:56:20.562Z" } } }, { "_index": ".entities.v1.latest.builtin_services_from_ecs_data", "_id": "2846700000000002", "_score": 1, "_source": { "service": { "name": "synth-go-logs", "environment": "Synthtrace: traces_logs_entities" }, "source_data_stream": { "type": [ "logs" ] }, "agent": { "name": [ "go" ] }, "entity": { "id": "2846700000000002", "type": "service", "definitionId": "latest", "lastSeenTimestamp": "2024-10-15T08:56:20.562Z" }, "event": { "ingested": "2024-10-15T08:56:20.562Z" } } } ] } } ```
- Loading branch information
1 parent
1bc487c
commit fe22ac9
Showing
26 changed files
with
474 additions
and
485 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
27 changes: 0 additions & 27 deletions
27
packages/kbn-apm-synthtrace-client/src/lib/assets/asset.ts
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
packages/kbn-apm-synthtrace-client/src/lib/assets/index.ts
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
packages/kbn-apm-synthtrace-client/src/lib/assets/service_assets.ts
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
packages/kbn-apm-synthtrace-client/src/lib/entities/container_entity.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,43 @@ | ||
/* | ||
* 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 { EntityDataStreamType, EntityFields } from '.'; | ||
import { Serializable } from '../serializable'; | ||
|
||
class ContainerEntity extends Serializable<EntityFields> { | ||
constructor(fields: EntityFields) { | ||
super({ | ||
...fields, | ||
'entity.type': 'container', | ||
'entity.definitionId': 'latest', | ||
}); | ||
} | ||
} | ||
|
||
export function containerEntity({ | ||
agentName, | ||
dataStreamType, | ||
dataStreamDataset, | ||
containerId, | ||
entityId, | ||
}: { | ||
agentName: string[]; | ||
dataStreamType: EntityDataStreamType[]; | ||
dataStreamDataset: string; | ||
containerId: string; | ||
entityId: string; | ||
}) { | ||
return new ContainerEntity({ | ||
'source_data_stream.type': dataStreamType, | ||
'source_data_stream.dataset': dataStreamDataset, | ||
'agent.name': agentName, | ||
'container.id': containerId, | ||
'entity.id': entityId, | ||
}); | ||
} |
43 changes: 43 additions & 0 deletions
43
packages/kbn-apm-synthtrace-client/src/lib/entities/host_entity.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,43 @@ | ||
/* | ||
* 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 { EntityDataStreamType, EntityFields } from '.'; | ||
import { Serializable } from '../serializable'; | ||
|
||
class HostEntity extends Serializable<EntityFields> { | ||
constructor(fields: EntityFields) { | ||
super({ | ||
...fields, | ||
'entity.type': 'host', | ||
'entity.definitionId': 'latest', | ||
}); | ||
} | ||
} | ||
|
||
export function hostEntity({ | ||
agentName, | ||
dataStreamType, | ||
dataStreamDataset, | ||
hostName, | ||
entityId, | ||
}: { | ||
agentName: string[]; | ||
dataStreamType: EntityDataStreamType[]; | ||
dataStreamDataset: string; | ||
hostName: string; | ||
entityId: string; | ||
}) { | ||
return new HostEntity({ | ||
'source_data_stream.type': dataStreamType, | ||
'source_data_stream.dataset': dataStreamDataset, | ||
'agent.name': agentName, | ||
'host.name': hostName, | ||
'entity.id': entityId, | ||
}); | ||
} |
35 changes: 35 additions & 0 deletions
35
packages/kbn-apm-synthtrace-client/src/lib/entities/index.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,35 @@ | ||
/* | ||
* 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 { Fields } from '../entity'; | ||
import { serviceEntity } from './service_entity'; | ||
import { hostEntity } from './host_entity'; | ||
import { containerEntity } from './container_entity'; | ||
|
||
export type EntityDataStreamType = 'metrics' | 'logs' | 'traces'; | ||
|
||
export type EntityFields = Fields & | ||
Partial<{ | ||
'agent.name': string[]; | ||
'source_data_stream.type': string | string[]; | ||
'source_data_stream.dataset': string | string[]; | ||
'event.ingested': string; | ||
sourceIndex: string; | ||
'entity.lastSeenTimestamp': string; | ||
'entity.schemaVersion': string; | ||
'entity.definitionVersion': string; | ||
'entity.displayName': string; | ||
'entity.identityFields': string | string[]; | ||
'entity.id': string; | ||
'entity.type': string; | ||
'entity.definitionId': string; | ||
[key: string]: any; | ||
}>; | ||
|
||
export const entities = { serviceEntity, hostEntity, containerEntity }; |
43 changes: 43 additions & 0 deletions
43
packages/kbn-apm-synthtrace-client/src/lib/entities/service_entity.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,43 @@ | ||
/* | ||
* 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 { EntityDataStreamType, EntityFields } from '.'; | ||
import { Serializable } from '../serializable'; | ||
|
||
class ServiceEntity extends Serializable<EntityFields> { | ||
constructor(fields: EntityFields) { | ||
super({ | ||
...fields, | ||
'entity.type': 'service', | ||
'entity.definitionId': 'latest', | ||
}); | ||
} | ||
} | ||
|
||
export function serviceEntity({ | ||
agentName, | ||
dataStreamType, | ||
serviceName, | ||
environment, | ||
entityId, | ||
}: { | ||
agentName: string[]; | ||
serviceName: string; | ||
dataStreamType: EntityDataStreamType[]; | ||
environment?: string; | ||
entityId: string; | ||
}) { | ||
return new ServiceEntity({ | ||
'service.name': serviceName, | ||
'service.environment': environment, | ||
'source_data_stream.type': dataStreamType, | ||
'agent.name': agentName, | ||
'entity.id': entityId, | ||
}); | ||
} |
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
Oops, something went wrong.