Skip to content

Commit

Permalink
[8.x] [Synthtrace] Adding Entities support (#196258) (#196645)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[Synthtrace] Adding Entities support
(#196258)](#196258)

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

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

<!--BACKPORT [{"author":{"name":"Cauê
Marcondes","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-15T15:21:32Z","message":"[Synthtrace]
Adding Entities support (#196258)\n\n## known issue\r\n```\r\n-
Transforms are not started by synthtrace. \r\nBecause it duplicates data
ingested by synthrace on signal indices. And it takes a long time to
generate data.\r\n\r\n- We are not able to open the Inventory page
because of 👆🏻.\r\n```\r\n---\r\n\r\n```\r\nnode scripts/synthtrace.js
traces_logs_entities.ts --clean --live\r\n```\r\nor \r\n```\r\nnode
scripts/synthtrace.js traces_logs_entities.ts --clean
--from=2024-04-08T08:00:00.000Z
--to=2024-04-08T08:15:00.000Z\r\n```\r\n\r\ndocs produces by the new
scenario:\r\n```\r\n{\r\n \"took\": 1,\r\n \"timed_out\": false,\r\n
\"_shards\": {\r\n \"total\": 1,\r\n \"successful\": 1,\r\n \"skipped\":
0,\r\n \"failed\": 0\r\n },\r\n \"hits\": {\r\n \"total\": {\r\n
\"value\": 3,\r\n \"relation\": \"eq\"\r\n },\r\n \"max_score\": 1,\r\n
\"hits\": [\r\n {\r\n \"_index\":
\".entities.v1.latest.builtin_services_from_ecs_data\",\r\n \"_id\":
\"2846700000000001\",\r\n \"_score\": 1,\r\n \"_source\": {\r\n
\"service\": {\r\n \"name\": \"synth-node-trace-logs\",\r\n
\"environment\": \"Synthtrace: traces_logs_entities\"\r\n },\r\n
\"source_data_stream\": {\r\n \"type\": [\r\n \"traces\",\r\n
\"logs\"\r\n ]\r\n },\r\n \"agent\": {\r\n \"name\": [\r\n
\"nodejs\"\r\n ]\r\n },\r\n \"entity\": {\r\n \"id\":
\"2846700000000001\",\r\n \"type\": \"service\",\r\n \"definitionId\":
\"latest\",\r\n \"lastSeenTimestamp\": \"2024-10-15T08:56:20.562Z\"\r\n
},\r\n \"event\": {\r\n \"ingested\": \"2024-10-15T08:56:20.562Z\"\r\n
}\r\n }\r\n },\r\n {\r\n \"_index\":
\".entities.v1.latest.builtin_services_from_ecs_data\",\r\n \"_id\":
\"2846700000000000\",\r\n \"_score\": 1,\r\n \"_source\": {\r\n
\"service\": {\r\n \"name\": \"synth-java-trace\",\r\n \"environment\":
\"Synthtrace: traces_logs_entities\"\r\n },\r\n \"source_data_stream\":
{\r\n \"type\": [\r\n \"traces\"\r\n ]\r\n },\r\n \"agent\": {\r\n
\"name\": [\r\n \"java\"\r\n ]\r\n },\r\n \"entity\": {\r\n \"id\":
\"2846700000000000\",\r\n \"type\": \"service\",\r\n \"definitionId\":
\"latest\",\r\n \"lastSeenTimestamp\": \"2024-10-15T08:56:20.562Z\"\r\n
},\r\n \"event\": {\r\n \"ingested\": \"2024-10-15T08:56:20.562Z\"\r\n
}\r\n }\r\n },\r\n {\r\n \"_index\":
\".entities.v1.latest.builtin_services_from_ecs_data\",\r\n \"_id\":
\"2846700000000002\",\r\n \"_score\": 1,\r\n \"_source\": {\r\n
\"service\": {\r\n \"name\": \"synth-go-logs\",\r\n \"environment\":
\"Synthtrace: traces_logs_entities\"\r\n },\r\n \"source_data_stream\":
{\r\n \"type\": [\r\n \"logs\"\r\n ]\r\n },\r\n \"agent\": {\r\n
\"name\": [\r\n \"go\"\r\n ]\r\n },\r\n \"entity\": {\r\n \"id\":
\"2846700000000002\",\r\n \"type\": \"service\",\r\n \"definitionId\":
\"latest\",\r\n \"lastSeenTimestamp\": \"2024-10-15T08:56:20.562Z\"\r\n
},\r\n \"event\": {\r\n \"ingested\": \"2024-10-15T08:56:20.562Z\"\r\n
}\r\n }\r\n }\r\n ]\r\n
}\r\n}\r\n```","sha":"fe22ac99281c9750e9dd55b16fc3ca284ba7683c","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport
missing","v9.0.0","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services","v8.17.0"],"number":196258,"url":"https://github.com/elastic/kibana/pull/196258","mergeCommit":{"message":"[Synthtrace]
Adding Entities support (#196258)\n\n## known issue\r\n```\r\n-
Transforms are not started by synthtrace. \r\nBecause it duplicates data
ingested by synthrace on signal indices. And it takes a long time to
generate data.\r\n\r\n- We are not able to open the Inventory page
because of 👆🏻.\r\n```\r\n---\r\n\r\n```\r\nnode scripts/synthtrace.js
traces_logs_entities.ts --clean --live\r\n```\r\nor \r\n```\r\nnode
scripts/synthtrace.js traces_logs_entities.ts --clean
--from=2024-04-08T08:00:00.000Z
--to=2024-04-08T08:15:00.000Z\r\n```\r\n\r\ndocs produces by the new
scenario:\r\n```\r\n{\r\n \"took\": 1,\r\n \"timed_out\": false,\r\n
\"_shards\": {\r\n \"total\": 1,\r\n \"successful\": 1,\r\n \"skipped\":
0,\r\n \"failed\": 0\r\n },\r\n \"hits\": {\r\n \"total\": {\r\n
\"value\": 3,\r\n \"relation\": \"eq\"\r\n },\r\n \"max_score\": 1,\r\n
\"hits\": [\r\n {\r\n \"_index\":
\".entities.v1.latest.builtin_services_from_ecs_data\",\r\n \"_id\":
\"2846700000000001\",\r\n \"_score\": 1,\r\n \"_source\": {\r\n
\"service\": {\r\n \"name\": \"synth-node-trace-logs\",\r\n
\"environment\": \"Synthtrace: traces_logs_entities\"\r\n },\r\n
\"source_data_stream\": {\r\n \"type\": [\r\n \"traces\",\r\n
\"logs\"\r\n ]\r\n },\r\n \"agent\": {\r\n \"name\": [\r\n
\"nodejs\"\r\n ]\r\n },\r\n \"entity\": {\r\n \"id\":
\"2846700000000001\",\r\n \"type\": \"service\",\r\n \"definitionId\":
\"latest\",\r\n \"lastSeenTimestamp\": \"2024-10-15T08:56:20.562Z\"\r\n
},\r\n \"event\": {\r\n \"ingested\": \"2024-10-15T08:56:20.562Z\"\r\n
}\r\n }\r\n },\r\n {\r\n \"_index\":
\".entities.v1.latest.builtin_services_from_ecs_data\",\r\n \"_id\":
\"2846700000000000\",\r\n \"_score\": 1,\r\n \"_source\": {\r\n
\"service\": {\r\n \"name\": \"synth-java-trace\",\r\n \"environment\":
\"Synthtrace: traces_logs_entities\"\r\n },\r\n \"source_data_stream\":
{\r\n \"type\": [\r\n \"traces\"\r\n ]\r\n },\r\n \"agent\": {\r\n
\"name\": [\r\n \"java\"\r\n ]\r\n },\r\n \"entity\": {\r\n \"id\":
\"2846700000000000\",\r\n \"type\": \"service\",\r\n \"definitionId\":
\"latest\",\r\n \"lastSeenTimestamp\": \"2024-10-15T08:56:20.562Z\"\r\n
},\r\n \"event\": {\r\n \"ingested\": \"2024-10-15T08:56:20.562Z\"\r\n
}\r\n }\r\n },\r\n {\r\n \"_index\":
\".entities.v1.latest.builtin_services_from_ecs_data\",\r\n \"_id\":
\"2846700000000002\",\r\n \"_score\": 1,\r\n \"_source\": {\r\n
\"service\": {\r\n \"name\": \"synth-go-logs\",\r\n \"environment\":
\"Synthtrace: traces_logs_entities\"\r\n },\r\n \"source_data_stream\":
{\r\n \"type\": [\r\n \"logs\"\r\n ]\r\n },\r\n \"agent\": {\r\n
\"name\": [\r\n \"go\"\r\n ]\r\n },\r\n \"entity\": {\r\n \"id\":
\"2846700000000002\",\r\n \"type\": \"service\",\r\n \"definitionId\":
\"latest\",\r\n \"lastSeenTimestamp\": \"2024-10-15T08:56:20.562Z\"\r\n
},\r\n \"event\": {\r\n \"ingested\": \"2024-10-15T08:56:20.562Z\"\r\n
}\r\n }\r\n }\r\n ]\r\n
}\r\n}\r\n```","sha":"fe22ac99281c9750e9dd55b16fc3ca284ba7683c"}},"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/196258","number":196258,"mergeCommit":{"message":"[Synthtrace]
Adding Entities support (#196258)\n\n## known issue\r\n```\r\n-
Transforms are not started by synthtrace. \r\nBecause it duplicates data
ingested by synthrace on signal indices. And it takes a long time to
generate data.\r\n\r\n- We are not able to open the Inventory page
because of 👆🏻.\r\n```\r\n---\r\n\r\n```\r\nnode scripts/synthtrace.js
traces_logs_entities.ts --clean --live\r\n```\r\nor \r\n```\r\nnode
scripts/synthtrace.js traces_logs_entities.ts --clean
--from=2024-04-08T08:00:00.000Z
--to=2024-04-08T08:15:00.000Z\r\n```\r\n\r\ndocs produces by the new
scenario:\r\n```\r\n{\r\n \"took\": 1,\r\n \"timed_out\": false,\r\n
\"_shards\": {\r\n \"total\": 1,\r\n \"successful\": 1,\r\n \"skipped\":
0,\r\n \"failed\": 0\r\n },\r\n \"hits\": {\r\n \"total\": {\r\n
\"value\": 3,\r\n \"relation\": \"eq\"\r\n },\r\n \"max_score\": 1,\r\n
\"hits\": [\r\n {\r\n \"_index\":
\".entities.v1.latest.builtin_services_from_ecs_data\",\r\n \"_id\":
\"2846700000000001\",\r\n \"_score\": 1,\r\n \"_source\": {\r\n
\"service\": {\r\n \"name\": \"synth-node-trace-logs\",\r\n
\"environment\": \"Synthtrace: traces_logs_entities\"\r\n },\r\n
\"source_data_stream\": {\r\n \"type\": [\r\n \"traces\",\r\n
\"logs\"\r\n ]\r\n },\r\n \"agent\": {\r\n \"name\": [\r\n
\"nodejs\"\r\n ]\r\n },\r\n \"entity\": {\r\n \"id\":
\"2846700000000001\",\r\n \"type\": \"service\",\r\n \"definitionId\":
\"latest\",\r\n \"lastSeenTimestamp\": \"2024-10-15T08:56:20.562Z\"\r\n
},\r\n \"event\": {\r\n \"ingested\": \"2024-10-15T08:56:20.562Z\"\r\n
}\r\n }\r\n },\r\n {\r\n \"_index\":
\".entities.v1.latest.builtin_services_from_ecs_data\",\r\n \"_id\":
\"2846700000000000\",\r\n \"_score\": 1,\r\n \"_source\": {\r\n
\"service\": {\r\n \"name\": \"synth-java-trace\",\r\n \"environment\":
\"Synthtrace: traces_logs_entities\"\r\n },\r\n \"source_data_stream\":
{\r\n \"type\": [\r\n \"traces\"\r\n ]\r\n },\r\n \"agent\": {\r\n
\"name\": [\r\n \"java\"\r\n ]\r\n },\r\n \"entity\": {\r\n \"id\":
\"2846700000000000\",\r\n \"type\": \"service\",\r\n \"definitionId\":
\"latest\",\r\n \"lastSeenTimestamp\": \"2024-10-15T08:56:20.562Z\"\r\n
},\r\n \"event\": {\r\n \"ingested\": \"2024-10-15T08:56:20.562Z\"\r\n
}\r\n }\r\n },\r\n {\r\n \"_index\":
\".entities.v1.latest.builtin_services_from_ecs_data\",\r\n \"_id\":
\"2846700000000002\",\r\n \"_score\": 1,\r\n \"_source\": {\r\n
\"service\": {\r\n \"name\": \"synth-go-logs\",\r\n \"environment\":
\"Synthtrace: traces_logs_entities\"\r\n },\r\n \"source_data_stream\":
{\r\n \"type\": [\r\n \"logs\"\r\n ]\r\n },\r\n \"agent\": {\r\n
\"name\": [\r\n \"go\"\r\n ]\r\n },\r\n \"entity\": {\r\n \"id\":
\"2846700000000002\",\r\n \"type\": \"service\",\r\n \"definitionId\":
\"latest\",\r\n \"lastSeenTimestamp\": \"2024-10-15T08:56:20.562Z\"\r\n
},\r\n \"event\": {\r\n \"ingested\": \"2024-10-15T08:56:20.562Z\"\r\n
}\r\n }\r\n }\r\n ]\r\n
}\r\n}\r\n```","sha":"fe22ac99281c9750e9dd55b16fc3ca284ba7683c"}},{"branch":"8.17","label":"v8.17.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
  • Loading branch information
cauemarcondes authored Oct 17, 2024
1 parent 5453ac0 commit 466c71b
Show file tree
Hide file tree
Showing 26 changed files with 491 additions and 485 deletions.
2 changes: 1 addition & 1 deletion packages/kbn-apm-synthtrace-client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ export { generateLongId, generateShortId } from './src/lib/utils/generate_id';
export { appendHash, hashKeysOf } from './src/lib/utils/hash';
export type { ESDocumentWithOperation, SynthtraceESAction, SynthtraceGenerator } from './src/types';
export { log, type LogDocument, LONG_FIELD_NAME } from './src/lib/logs';
export { type AssetDocument } from './src/lib/assets';
export { syntheticsMonitor, type SyntheticsMonitorDocument } from './src/lib/synthetics';
export { type EntityFields, entities } from './src/lib/entities';
27 changes: 0 additions & 27 deletions packages/kbn-apm-synthtrace-client/src/lib/assets/asset.ts

This file was deleted.

12 changes: 0 additions & 12 deletions packages/kbn-apm-synthtrace-client/src/lib/assets/index.ts

This file was deleted.

This file was deleted.

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 packages/kbn-apm-synthtrace-client/src/lib/entities/host_entity.ts
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 packages/kbn-apm-synthtrace-client/src/lib/entities/index.ts
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 };
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,
});
}
2 changes: 1 addition & 1 deletion packages/kbn-apm-synthtrace/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export { InfraSynthtraceEsClient } from './src/lib/infra/infra_synthtrace_es_cli
export { InfraSynthtraceKibanaClient } from './src/lib/infra/infra_synthtrace_kibana_client';
export { MonitoringSynthtraceEsClient } from './src/lib/monitoring/monitoring_synthtrace_es_client';
export { LogsSynthtraceEsClient } from './src/lib/logs/logs_synthtrace_es_client';
export { AssetsSynthtraceEsClient } from './src/lib/assets/assets_synthtrace_es_client';
export { EntitiesSynthtraceEsClient } from './src/lib/entities/entities_synthtrace_es_client';
export { SyntheticsSynthtraceEsClient } from './src/lib/synthetics/synthetics_synthtrace_es_client';
export {
addObserverVersionTransform,
Expand Down
11 changes: 8 additions & 3 deletions packages/kbn-apm-synthtrace/src/cli/scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@ import {
InfraSynthtraceEsClient,
LogsSynthtraceEsClient,
SyntheticsSynthtraceEsClient,
EntitiesSynthtraceEsClient,
} from '../..';
import { AssetsSynthtraceEsClient } from '../lib/assets/assets_synthtrace_es_client';
import { Logger } from '../lib/utils/create_logger';
import { ScenarioReturnType } from '../lib/utils/with_client';
import { RunOptions } from './utils/parse_run_cli_flags';
import { EntitiesSynthtraceKibanaClient } from '../lib/apm/client/entities_synthtrace_kibana_client';

interface EsClients {
apmEsClient: ApmSynthtraceEsClient;
logsEsClient: LogsSynthtraceEsClient;
infraEsClient: InfraSynthtraceEsClient;
assetsEsClient: AssetsSynthtraceEsClient;
syntheticsEsClient: SyntheticsSynthtraceEsClient;
entitiesEsClient: EntitiesSynthtraceEsClient;
}

interface KibanaClients {
entitiesKibanaClient: EntitiesSynthtraceKibanaClient;
}

type Generate<TFields> = (options: {
Expand All @@ -33,6 +38,6 @@ type Generate<TFields> = (options: {
}) => ScenarioReturnType<TFields> | Array<ScenarioReturnType<TFields>>;

export type Scenario<TFields> = (options: RunOptions & { logger: Logger }) => Promise<{
bootstrap?: (options: EsClients) => Promise<void>;
bootstrap?: (options: EsClients & KibanaClients) => Promise<void>;
generate: Generate<TFields>;
}>;
15 changes: 11 additions & 4 deletions packages/kbn-apm-synthtrace/src/cli/utils/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import { getInfraEsClient } from './get_infra_es_client';
import { getKibanaClient } from './get_kibana_client';
import { getServiceUrls } from './get_service_urls';
import { RunOptions } from './parse_run_cli_flags';
import { getAssetsEsClient } from './get_assets_es_client';
import { getSyntheticsEsClient } from './get_synthetics_es_client';
import { getEntitiesEsClient } from './get_entities_es_client';
import { getEntitiesKibanaClient } from './get_entites_kibana_client';

export async function bootstrap(runOptions: RunOptions) {
const logger = createLogger(runOptions.logLevel);
Expand Down Expand Up @@ -57,12 +58,17 @@ export async function bootstrap(runOptions: RunOptions) {
concurrency: runOptions.concurrency,
});

const assetsEsClient = getAssetsEsClient({
const entitiesEsClient = getEntitiesEsClient({
target: esUrl,
logger,
concurrency: runOptions.concurrency,
});

const entitiesKibanaClient = getEntitiesKibanaClient({
target: kibanaUrl,
logger,
});

const syntheticsEsClient = getSyntheticsEsClient({
target: esUrl,
logger,
Expand All @@ -73,7 +79,7 @@ export async function bootstrap(runOptions: RunOptions) {
await apmEsClient.clean();
await logsEsClient.clean();
await infraEsClient.clean();
await assetsEsClient.clean();
await entitiesEsClient.clean();
await syntheticsEsClient.clean();
}

Expand All @@ -82,10 +88,11 @@ export async function bootstrap(runOptions: RunOptions) {
apmEsClient,
logsEsClient,
infraEsClient,
assetsEsClient,
entitiesEsClient,
syntheticsEsClient,
version,
kibanaUrl,
esUrl,
entitiesKibanaClient,
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import { LogDocument } from '@kbn/apm-synthtrace-client';
import { createAssetsAggregatorFactory } from '../../utils/create_assets_aggregator_factory';
import { EntitiesSynthtraceKibanaClient } from '../../lib/apm/client/entities_synthtrace_kibana_client';
import { Logger } from '../../lib/utils/create_logger';

export const createLogsAssetsAggregator = createAssetsAggregatorFactory<LogDocument>();
export function getEntitiesKibanaClient({ target, logger }: { target: string; logger: Logger }) {
const kibanaClient = new EntitiesSynthtraceKibanaClient({
logger,
target,
});

return kibanaClient;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
*/

import { Client } from '@elastic/elasticsearch';
import { AssetsSynthtraceEsClient } from '../../lib/assets/assets_synthtrace_es_client';
import { EntitiesSynthtraceEsClient } from '../../lib/entities/entities_synthtrace_es_client';
import { Logger } from '../../lib/utils/create_logger';
import { RunOptions } from './parse_run_cli_flags';
import { getEsClientTlsSettings } from './ssl';

export function getAssetsEsClient({
export function getEntitiesEsClient({
target,
logger,
concurrency,
Expand All @@ -26,7 +26,7 @@ export function getAssetsEsClient({
tls: getEsClientTlsSettings(target),
});

return new AssetsSynthtraceEsClient({
return new EntitiesSynthtraceEsClient({
client,
logger,
concurrency,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function startHistoricalDataUpload({
from: Date;
to: Date;
}) {
const { logger, esUrl, version } = await bootstrap(runOptions);
const { logger, esUrl, version, kibanaUrl } = await bootstrap(runOptions);

const cores = cpus().length;

Expand Down Expand Up @@ -93,6 +93,7 @@ export async function startHistoricalDataUpload({
workerId: workerIndex.toString(),
esUrl,
version,
kibanaUrl,
};
const worker = new Worker(Path.join(__dirname, './worker.js'), {
workerData,
Expand Down
Loading

0 comments on commit 466c71b

Please sign in to comment.